How can I transfer a complete directory from a remote FTP-Server to a local Folder?
property download_path : "ftp://LOGIN:PASSWORD@MyDomain.net/public_html/"
property server_name : "blog"
property download_folder : "Spencer:Users:USERNAME:Desktop:download"
on run
tell application "Finder"
-- open location download_path
--delay 10
tell application "URL Access Scripting"
open location download_path
delay 10
download download_path & server_name to download_folder
end tell
end tell
end run
The above script is mounting the correct directory (public_html) on my desktop. But it doesn’t copy the directory blog to the download folder on my desktop.
property download_path : "ftp://LOGIN:PASSWORD@MyDomain.net/public_html/"
property download_folder : path to desktop as string
on run
set download_directory to "blog"
set download_URL to (download_path & download_directory)
display dialog download_URL
set file_path to download_folder
display dialog download_folder
tell application "URL Access Scripting"
set file_downloaded to download download_URL to file file_path replacing yes
end tell
end run
This isn’t working and I guess it has something to do with POSIX-settings?
Any Ideas how to get connected, download a directory and (would be great) eject the FTP-Volume again?
Best regards from berlin, germany
phil
Model: iBook G3 800Mhz
AppleScript: AppleScript 1.10
Browser: Safari 412.5
Operating System: Mac OS X (10.4)
I haven’t used URL Access since OS9, but back then it required a file specification. As best as I remember, it didn’t do whole directories. Someone else who knows more will probably chime in. Did you see the example in that link you found where they use finder to connect and then just duplicate the folder. That seems like a good solution. I always script Fetch for FTP since it buys me nice error reporting, etc.
I don’t see why you’d want to supply a posix path to URL access… I think you’ve got that part right. When you say it’s not working, what do you mean? Error message, timeout, etc?
good news: I got a working solution.
The script connects to my FTP server and get a copy of the directory blog that is under public_html.
property download_path : "ftp://LOGIN:PASSWORD@SERVER/public_html/"
property server_name : "public_html"
property directory_to_download : "blog"
property download_folder : path to desktop as string
on run
tell application "Finder"
open location download_path
delay 10
set download_URL to (server_name & ":" & directory_to_download) as alias
set file_downloaded to duplicate download_URL to folder download_folder
delay 10
eject (server_name as alias)
end tell
end run
bad news: The download isn’t very fast and AppleScript is aborting because it’s waiting to long.
Question: Is there another way to download a directory from a FTP-server without using 3rd party apps like Fetch, Transmit or Interarchy since there not free.
I guess there has to be a better solution using the shell.
Any ideas?
Model: iBook G3 800Mhz
AppleScript: 1.10
Browser: Safari 412.5
Operating System: Mac OS X (10.4)
The finder makes things real simple, but there is some added overhead. Most of the time required is probably the time it takes to move the files, though. You could write a shell script or call ftp commands with AppleScript’s do shell script command if you wanted to use raw FTP and bypass the finder.
Thanks for the link about how to fix the timeout problem. I found a solution about how to transfer files via FTP without using a non-freeware-apps. I use Cyberduck now:
tell application "Cyberduck"
set theServer to "SERVER.COM"
set theUser to "LOGIN"
set thePassword to "PASSWORD"
set theProtocol to "ftp"
set theRemoteFolder to "/public_html/blog"
set theLocalFolder to "~/Desktop/"
set theBrowser to (make new browser)
with timeout of 3000 seconds
tell (theBrowser)
set the encoding to "UTF-8"
set show hidden to true
connect to theServer with protocol theProtocol as user theUser with password thePassword
change folder to theRemoteFolder
sync folder (get working folder) with local folder theLocalFolder
disconnect
end tell
end timeout
end tell
is doing everything I need.
I really like the Transmit-Client scripting capabilities, but 1) it’s not freeware and 2) it shows an annoying “Everything done” Message after the transfer that stops the applescript from continueing.
regards
Phil
Model: iBook G3 800Mhz
AppleScript: 1.10
Browser: Safari 412.5
Operating System: Mac OS X (10.4)