我正在尝试使用 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 文件中压缩整个文件夹结构,
用户:我的用户:文档:我的文件夹:
我只想在没有此文件夹结构的情况下压缩文件夹内的整个文件。我的意思是连MyFolder
. 只是压缩文件里面的文件。
?