Your best friend for file transfer.

Fetch application logoFetch

Problem checking for an existing file with applescript (2 posts)

This is an archived topic. The information in it is likely to be out-of-date and no longer applicable to current versions of Fetch.
  • Started 12 years ago by SteveD
  • Latest reply 12 years ago from Jim Matthews
  • SteveD Member

    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.

    Posted 12 years ago #

  • Jim Matthews Administrator

    The easiest thing is to just try to do the download, and catch the error if it fails:

    try
    copy url "ftp://userid :password@host/path/file" to beginning of alias "HD:folder:"
    on error
    display dialog "There was an error"
    end try

    I hope this helps,

    Jim Matthews
    Fetch Softworks

    [This message has been edited by JimMatthews (edited 02-11-2002).]

    Posted 12 years ago #

Topic closed

This topic has been closed.