0
我想壓縮使用AppleScript的文件夾內的整個文件。我使用這個代碼,AppleScript壓縮沒有文件夾結構的文件夾?
tell application "Finder"
set x1 to (path to home folder as text)
set theItem to x1 & "Documents:MyFolder" as alias
set itemPath to quoted form of POSIX path of theItem
set fileName to name of theItem
set theFolder to POSIX path of (container of theItem as alias)
set zipFile to quoted form of (theFolder & fileName & ".zip")
do shell script "zip -r " & zipFile & " " & itemPath
end tell
這工作正常。但它呼嘯而過的整個文件夾結構是這樣的zip文件中,
用戶:MYUSER:文件:MyFolder文件:
我想只是壓縮的文件夾內的所有文件,而這個文件夾結構。我的意思是甚至沒有MyFolder
。只需將文件放入一個zip文件即可。
?
燦爛的答案。奇蹟般有效。 –