Applescript从Google Team Drive复制文件

Applescript从Google Team Drive复制文件,applescript,google-drive-shared-drive,Applescript,Google Drive Shared Drive,我正试图将Google Team Drive上的文件夹复制到另一个位置,但我的脚本不断出错。全文如下 我基本上希望将Excel文件“Google Drive:Team Drive:Company-Sync文件夹:0000-1_E.xlsx”复制到脚本定义的位置 令人不快的是: duplicate file "Google Drive:Team Drives:Company -Sync Folder:0000-1_E.xlsx" of startup disk to folder (jobNum

我正试图将Google Team Drive上的文件夹复制到另一个位置,但我的脚本不断出错。全文如下

我基本上希望将Excel文件“Google Drive:Team Drive:Company-Sync文件夹:0000-1_E.xlsx”复制到脚本定义的位置

令人不快的是:

duplicate file "Google Drive:Team Drives:Company -Sync Folder:0000-1_E.xlsx" of startup disk to folder (jobNum & " Documents") of newJobFolder
有什么帮助吗

global jobNum
global newJobFolder
set jobNum to text returned of (display dialog "Enter a job number:" default answer "")
set jobName to text returned of (display dialog "Enter a job name:" default answer "")
set jobMgr to text returned of (display dialog "Enter account manager email:" default answer "")
set folderpath to (choose folder with prompt "Select client folder")
set newJobFolder to my newFold(jobNum, jobName, folderpath, jobMgr)


on newFold(theNumber, theName, thefolder, jobMgr)
    set emailAddress to jobMgr
    set emailSubject to theNumber & " -" & theName
    set bodyText to ""
    set emailLinkFileName to theNumber & " -" & theName

    set subNameList to {"Designs", "Documents", "Received"}
    set itemCount to count of subNameList
    set linkBody to "mailto:" & emailAddress & "?subject=" & my replace_chars(emailSubject, " ", "%20") & "&body=" & my replace_chars(bodyText, " ", "%20")
    tell application "Finder"
        set newJobFolder to (make new folder at thefolder with properties ¬
            {name:theNumber & " " & theName})
        repeat with i from 1 to itemCount
            set aSubFolder to make new folder at newJobFolder with properties {name:jobNum & " " & item i of subNameList}
            set theMailto to make new internet location file to linkBody at aSubFolder with properties {name:emailLinkFileName, name extension:"mailloc"}
            set the name extension of theMailto to "mailloc"
        end repeat
        duplicate file "Google Drive:Team Drives:Company -Sync Folder:0000-1_E.xlsx" of startup disk to folder (jobNum & " Documents") of newJobFolder
        set name of the result to jobNum & " E.xlsx"
        set theMailto to make new internet location file to linkBody at newJobFolder with properties {name:emailLinkFileName, name extension:"mailloc"}
        set the name extension of theMailto to "mailloc"
    end tell
end newFold

-- Generic find and replace functionality
on replace_chars(this_text, search_string, replacement_string)
    set AppleScript's text item delimiters to the search_string
    set the item_list to every text item of this_text
    set AppleScript's text item delimiters to the replacement_string
    set this_text to the item_list as string
    set AppleScript's text item delimiters to ""
    return this_text
end replace_chars
假设您的“Google Drive”文件夹直接位于您的主文件夹中

试着改变这个

duplicate file "Google Drive:Team Drives:Company -Sync Folder:0000-1_E.xlsx" of startup disk to folder (jobNum & " Documents") of newJobFolder
对此

set theFile to (path to home folder as text) & "Google Drive:Team Drives:Company -Sync Folder:0000-1_E.xlsx"
duplicate file theFile to folder (jobNum & " Documents") of newJobFolder
如果这不起作用,你可以尝试这种方法

set theFile to (choose file) as alias as text
duplicate file theFile to folder (jobNum & " Documents") of newJobFolder

然后在运行一次之后,注释掉choosefile命令

如果您使用的是Google Drive File Stream,这是一个面向企业的文件流,则可以通过用户文件夹访问安装的驱动器,路径如下所示:

“/Users/nameofuser/Google驱动器文件流/My Drive/Companyfolder”


使用此格式访问文件夹,它应该可以工作,我就是这么做的。

给出了什么错误消息?Finder遇到了一个错误:无法将启动盘文件夹“用户”的文件夹“ace”的文件夹“桌面”的文件夹“0000 test0000”的文件夹“0000 Documents”设置为启动盘的文件“团队驱动器:公司-同步文件夹:0000-1_E.xlsx”。如果,正如您在下面所说,您的Google Drive文件夹是一个已装入的驱动器,因此它不是启动盘的子文件夹。尝试从问题行中删除启动盘的
。google drive是一个已安装的驱动器,因此它出现在我们正在使用新google文件流的设备中,因此不再显示为文件夹