的相對路徑相當於是
set desktopFolder to path to desktop
tell application "Finder"
set a to folder "Files:" of desktopFolder
set b to folder "Copies:" of desktopFolder
duplicate every file of a to b
end tell
但Finder中有一個屬性desktop
總是指向當前用戶的桌面文件夾中。
tell application "Finder"
set a to folder "Files:" of desktop
set b to folder "Copies:" of desktop
duplicate every file of a to b
end tell
而且 - 更短 - 當前用戶的桌面文件夾是在Finder的 「根」 文件夾
tell application "Finder"
duplicate every file of folder "Files" to folder "Copies"
end tell
編輯:
相當於
~/Library/Containers/com.apple.iWork.Numbers/Data/Library/Application Support/User Templates
((path to library folder from user domain as text) & "Containers:com.apple.iWork.Numbers:Data:Library:Application Support:User Templates:")
謝謝@vadian但如果目標是不是在桌面上,但在用戶庫更深的路徑? – Zeton
這個路徑是確切的:〜/ Library/Containers/com.apple.iWork.Numbers/Data/Library/Application Support/User Templates – Zeton
我更新了答案 – vadian