我正在尝试设置一个脚本,将模板文件复制到新创建的文件夹中。该文件是从template_name创建的变量。不幸的是我是一个posix新手,似乎无法获得将模板文件复制到新文件夹的脚本。
返回的错误是 “无法将应用程序”Finder“的”/ Volumes / Media / NewFolder“设置为应用程序”Finder“的文件”Volumes / Media / + A3Temp.ptx“
set temp_name to client_code & " " & brand_name & " " & job_name & " " & job_number & " " & creation_date
set media_folder to "/Volumes/Media/"
set new_folder to media_folder & temp_name
set template_name to ("+" & suite & "Temp.ptx") as string
set session_name to (client_code & " " & brand_name & " " & job_name & " " & creation_date & ".ptx")
set template to (media_folder & template_name)
tell application "Finder"
duplicate POSIX file template to POSIX file new_folder
end tell
我知道这些行的错误是
tell application "Finder"
duplicate POSIX file template to POSIX file new_folder
end tell
但我不知道如何补救它。任何人都可以帮忙!?
答案 0 :(得分:5)
运行此脚本时出现类似错误:
set f to "/usr/share/dict/connectives"
set d to "/private/tmp/"
tell application "Finder"
duplicate POSIX file f to POSIX file d
end tell
Finder收到错误:无法将POSIX文件“/ private / tmp /”设置为POSIX文件“/ usr / share / dict / connectives”。
其中任何一个都有效:
set f to POSIX file "/usr/share/dict/connectives"
set d to POSIX file "/private/tmp/"
tell application "Finder"
duplicate f to d
end tell
tell application "Finder"
duplicate POSIX file "/usr/share/dict/connectives" to POSIX file "/private/tmp/"
end tell