你好,
有人可以帮忙吗。 我尝试了很多但仍然失败。
我试图遍历 zip 文件夹列表以尝试查找 zip 文件夹子目录下的特定 txt 文件。当我在 zip 文件夹中获取文件列表时,我看到 txt 文件为 subdirector/mytxtfile_123.log。 下面是我的脚本,但它无法下载 txt 文件。存在 IO 问题,它抱怨“系统找不到指定的路径”。 我想知道当我获取文件列表时是否将“\”翻转为“/”。 有没有一种巧妙的方法可以将文件放在子目录或 zip 中?
path == path where all zip folder located;
path1 == path where txt file going to save;
lst = {the list of the zip folders};
for (k=1, k <=N items(lst), k++,
Try(
za = open(path||lst[k], zip);
dirlist = za << dir;
for (l=1, l<=N Items(dirlist), l++,
If (Contains(dirlist[l], "mytxtfile_"),
text = za << read(dirlist[l]);
save text file(path1||lst[k]||"_"||dirlist[l],text);
);
)
,
print (lst[k] || "fail to open");
Throw();
);
);