如何从AppleScript代码复制(复制)和移动文件与同一文件夹?

时间:2011-09-14 22:55:41

标签: file copy applescript duplicates

这些方面的东西?

tell application "Finder"
    duplicate file "somefile.txt" of folder of (file (path to me)) to folder applications of folder startup disk
end tell

1 个答案:

答案 0 :(得分:1)

你非常接近,但这是正确的剧本。

tell application "Finder" to duplicate "somefile.txt" of (container of (path to me)) to applications folder

tell application "Finder"
    set prevTIDs to Applescript's text item delimiters
    set Applescript's text item delimiters to ":"
    duplicate "somefile.txt" of (text items 1 thru -2 of (path to me as string)) as alias to applications folder
    set Applescript's text item delimiters to prevTIDs
end tell