【发布时间】:2013-05-01 00:45:24
【问题描述】:
我正在编写一个 scipt 来创建用户文件夹并将相关的应用程序模板复制到外部媒体卷上的主文件夹中。通过对话框提供较早的用户输入信息。 +A3Temp.ptx 文件已复制到 new_folder,现在我希望将“+A3Temp.ptx”文件重命名为使用 CreationDate_ClientFolder_BrandName_JobName 作为其文件名的格式。
这是我目前所拥有的,但最后阶段仍然返回类错误。
set temp_name to job_number & creation_date & client_folder & brand_name & job_name
set media_folder to "/Volumes/Media/"
set new_folder to media_folder & temp_name
set template_name to "+A3Temp.ptx"
set session_name to (creation_date & client_folder & brand_name & job_name & ".ptx")
tell application "Finder"
duplicate POSIX file "/Volumes/Media/+A3Temp.ptx" to POSIX file new_folder
end tell
tell application "Finder"
set name of POSIX file (new_folder & "/" & template_name) to POSIX file (new_folder & "/" & session_name)
end tell
错误返回为:
"Can't set <<class psxf>> "Volumes/Media/1223456_130430_clientfolder_BrandName_JobName/+A3Temp.ptx of application "Finder" to <<class psxf>> ""Volumes/Media/1223456_130430_clientfolder_BrandName_JobName/130430_clientfolder_BrandName_JobName.ptx" of application "Finder"
我做错了什么??????
【问题讨论】:
-
新文件名应该是这个..
CreationDate_ClientFolder_BrandName_JobName.ptx吧? -
是的,没错,但事实并非如此。
-
请在你的问题中修正它。它最后有“as its.ptx”。
标签: applescript rename file-rename