你好,
有人可以幫忙嗎。 我嘗試了很多但仍然失敗。
我試圖遍歷 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();
);
);