3
我有這個applescript需要選擇的項目和拉鍊文件/文件夾,並使用該名稱作爲zip名稱。我遇到的問題是,當我解壓縮zip文件時,它使得文件夾結構中的所有用戶的路徑都起作用。 像這樣:zip文件夾使用applescript
Users:
username:
folder:
folder:
我只是想它是:
folder:
下面是代碼:
tell application "Finder"
set theItem to selection 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
如果您使用-j,當有兩個具有相同名稱的文件時,您將看到一個錯誤。 – Peter