将文件复制到其他文件夹,然后将其重命名为当前日期

RHPT

我试图重新创建我写的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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在Powershell中复制文件夹并将其重命名为当前日期和时间?

递归搜索,将jpg文件复制并重命名为父文件夹名称

如何将colab我的云端硬盘文件夹重命名为其他名称?

从 csv 中的单列创建文件夹并使用其他列将文件重命名为文件夹

(Automator / AppleScript)将文件重命名为文件夹名称,保存到其他文件夹并添加前缀

如何将树结构的键复制到其他名称的键或重命名为其他名称?

在一个bash命令中将文件重命名为当前日期

遍历子目录,并(1)将文件复制到另一个目录(2)将其重命名为其md5哈希

将映射文件复制到名为Test_Performance_WithFilledExcelFile C#的其他文件夹

重命名文件并将重命名的文件复制到主文件夹中的 subbolder

将文件分组并按编号“拆分”,然后将其复制到文件夹中

将文件夹中的文件重命名为一个名称

使用powershell将多个文件夹重命名为大写而不是文件

从终端递归将所有文件和文件夹重命名为Title Case

使用xlswriter将文件命名为当前日期和时间

如何将图像从多个子文件夹复制到公共文件夹并重命名?

如何将文件夹复制到以sysdate重命名的新文件夹?

对于每个子文件夹,请按名称对文件进行排序,然后将其重命名为连续的填充数字(不考虑扩展名)

命令通过网络Xcopy文件夹并将目标位置的文件夹重命名为日期

将子文件夹中的文件批量重命名为父文件夹名称

如何将特定文件重命名为许多文件夹的文件夹名称

将文件从子文件夹复制到父文件夹并使用父文件夹名称重命名文件

C#将文件重命名为与其他目录中的文件相同的名称

将图像批量重命名为文件夹名称+序列号

递归地将文件夹重命名为@eaDir

将文件夹重命名为音乐的ID3标签?

将文件复制到其他文件夹-查找

Bash 移动文件并将其重命名为 username_filename 在不同的文件夹中

创建批处理文件以复制一个文件夹,然后生成1,000次,将其命名为“ AE 0001”,最高命名为“ AE 1000”