Your best friend for file transfer.Fetch
Problem checking for an existing file with applescript (2 posts)
- Started 12 years ago by SteveD
- Latest reply 12 years ago from Jim Matthews
I'm trying to automate the download of files with an applescript. It works fine when the file is there, but gives an error if the file is not. I've tried putting in file checking using this syntax from the help file:
index host "ftp.domain.com" user "fred" password "secret" path "remotedir/name.to.find"
but, I'm not sure exactly how to use it. I've got the full path the file (including the login/pass) stored in one variable called remotePath. How would I check if the file exists and then do perform an action if it does? Thanks for your help. Fetch is a lifesaver.
Jim Matthews Administrator
The easiest thing is to just try to do the download, and catch the error if it fails:
copy url "ftp://userid :password@host/path/file" to beginning of alias "HD:folder:"
display dialog "There was an error"
I hope this helps,
[This message has been edited by JimMatthews (edited 02-11-2002).]
- Page 1
This topic has been closed.