2

我正在尝试将我们网络上的文件夹备份到我的桌面,但我不确定如何访问共享网络上的文件夹。我的代码如下:

on run {input, parameters}

    set desktopFolder to "Macintosh HD:Users:James:Desktop:App Backups:"
    set todayDate to do shell script "date '+%Y.%m.%d'"
    set newFolderName to "Backup " & todayDate
    set destinationFolder to desktopFolder & newFolderName
    set sourceFolder to "smb://svr01/IT_Department/Design/_team/James/App"

    tell application "Finder"
        make new folder at alias desktopFolder with properties {name:newFolderName}
        copy folder sourceFolder to folder destinationFolder
    end tell

    return input
end run

我应该使用 smb://... 地址还是 Volumes/.... 地址,我应该如何格式化它?顺便说一句,我是一个完整的 AppleScript 新手!

谢谢詹姆斯

4

1 回答 1

2

copy只复制 AppleScript 值,而不是应用程序定义的对象。使用duplicate命令。

set sourceFolder to ("/Users/test/Desktop/untitled folder" as POSIX file)
set targetFolder to ("/Users/test/Desktop/untitled folder 2" as POSIX file)
tell application "Finder" to duplicate sourceFolder to targetFolder 

您可以使用 smb://... 地址。

于 2013-08-15T17:00:50.297 回答