我有以下腳本(修改爲刪除任何私人信息)。如何使用Fetch和applescript下載所有文件?
-- This line is for testing.
set the clipboard to "1234567890"
set loginName to "username"
-- Password is stored in KeyChain (you need to do manually).
-- Create Remote path
set folderNumber to the clipboard as string
set subdir1 to character 1 of folderNumber
set subdir2 to character 2 of folderNumber
set remotePath to "/files/" & subdir1 & "/" & subdir2 & "/" & folderNumber
-- Create Local path
set homeFolder to (path to home folder) as string
set localPath to homeFolder & "LOCALSTORAGE" as string
set localStorage to localPath & ":" & folderNumber & ":" as string
-- Create Local file
tell application "Finder"
try
make new folder at localPath with properties {name:folderNumber}
on error e number n
-- Do nothing.
end try
end tell
-- Connect to FTP
tell application "Fetch"
activate
set tWindow to make new transfer window at beginning with properties {hostname:"ftpServerAddress", username:loginName, initial folder:remotePath}
tell window tWindow
download every remote item to beginning of alias localStorage
close window
end tell
quit
end tell
-- Open folder
tell application "Finder"
open localStorage
end tell
當我運行腳本時,下面一行失敗。
download every remote item to beginning of alias localStorage
我得到的錯誤如下:
error "Fetch got an error: Can’t get every remote item of window (transfer window id 232280960)." number -1728 from every remote item of window (transfer window id 232280960)
有誰知道什麼錯誤意味着或如何解決呢?我嘗試了Fetch網站,但沒有多少運氣。 「取」btw是取FTP客戶端。
謝謝!這樣可行。我還發現你可以記錄「鏡像文件夾」選項的AppleScript。從那裏我得到了一個指令來把所有東西都拉過來。 – 2012-02-17 10:58:10