Applescript重命名重复文件:

Applescript重命名重复文件:,applescript,rename,file-rename,Applescript,Rename,File Rename,我正在编写一个scipt来创建用户文件夹,并将相关应用程序模板复制到外部媒体卷上的主文件夹中。早期用户输入的信息通过对话框提供。+A3Temp.ptx文件已复制到新的_文件夹,现在我希望将“+A3Temp.ptx”文件重命名为使用CreationDate_ClientFolder_BrandName_JobName作为其.ptx文件名的格式 这就是我到目前为止所做的,但是最后阶段仍然返回类错误 set temp_name to job_number & creation_date &am

我正在编写一个scipt来创建用户文件夹,并将相关应用程序模板复制到外部媒体卷上的主文件夹中。早期用户输入的信息通过对话框提供。+A3Temp.ptx文件已复制到新的_文件夹,现在我希望将“+A3Temp.ptx”文件重命名为使用CreationDate_ClientFolder_BrandName_JobName作为其.ptx文件名的格式

这就是我到目前为止所做的,但是最后阶段仍然返回类错误

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"
“无法将”应用程序“Finder”的卷/Media/1223456\u 130430\u clientfolder\u BrandName\u JobName/+A3Temp.ptx设置为“Finder”应用程序的“Volumes/Media/1223456\u 130430\u clientfolder\u BrandName\u JobName/130430\u clientfolder\u BrandName\u JobName.ptx”

我做错了什么????

将文件对象转换为别名:

tell application "Finder"
    set name of (POSIX file "/tmp/a" as alias) to "b"
end tell
如果新文件夹不存在,则“复制”不会创建它:

tell application "Finder"
    make new folder at media_folder with properties {name:temp_folder}
end tell

将文件对象转换为别名:

tell application "Finder"
    set name of (POSIX file "/tmp/a" as alias) to "b"
end tell
如果新文件夹不存在,则“复制”不会创建它:

tell application "Finder"
    make new folder at media_folder with properties {name:temp_folder}
end tell

新文件名应为..
CreationDate\u ClientFolder\u BrandName\u JobName.ptx,对吗?是的,没错,但事实并非如此。请在您的问题中解决它..它有“作为其.ptx”“最后。新文件名应为..
CreationDate\u ClientFolder\u BrandName\u JobName.ptx,对吗?是的,没错,但事实并非如此。请在问题中解决它。”。。它的结尾有“as-its.ptx”。谢谢劳里!壮观的它变成了这样:告诉应用程序“Finder”将(POSIX文件(新文件夹和“/”&模板名称)的名称设置为别名)到会话名称结束。谢谢Lauri!壮观的它变成这样:告诉应用程序“Finder”设置会话名称(POSIX文件(新文件夹和“/”&模板名称)作为别名)结束告诉