我试图重新创建我写的VBScript,它将文件复制到远程卷,然后用当前日期重命名该文件。有很多谷歌(和SO)的结果,但我似乎无法正确地做到这一点。下面是我所拥有的,但是当我运行它时,它将error "Finder got an error: Handler can’t handle objects of this class."
在重复命令上返回。
set {month:mm} to (current date)
set {day:d} to (current date)
set {year:y} to (current date)
set theDate to mm & "-" & d & "-" & y
set fileName to theDate & ".xml"
tell application "Finder"
duplicate POSIX file "/Users/RHPT/Documents/File.xml" to POSIX file "/Volumes/Public/Backup"
set name of POSIX file ("/Volumes/Public/Backup/File.xml" as alias) to fileName
end tell
尝试:
set {month:mm, day:d, year:y} to (current date)
set theDate to mm & "-" & d & "-" & y as text
set fileName to theDate & ".xml"
tell application "Finder"
set dupeFile to duplicate POSIX file "/Users/RHPT/Documents/File.xml" to POSIX file "/Volumes/Public/Backup"
set dupeFile's name to fileName
end tell
编辑
set {month:mm, day:d, year:y} to (current date)
set theDate to mm & "-" & d & "-" & y as text
set fileName to theDate & ".xml"
set sourceFile to POSIX file "/Users/RHPT/Documents/File.xml"
set destFolder to POSIX file "/Volumes/Public/Backup"
tell application "Finder"
set dupeFile to duplicate sourceFile to destFolder
set dupeFile's name to fileName
end tell
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句