Your best friend for file transfer.

Fetch application logoFetch

Automatically Downloading New Files in Directory (6 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 19 years ago by dvandelay
  • Latest reply 19 years ago from Jim Matthews
  • dvandelay Member

    Is there a way for Fetch to automatically detect new files (uploaded by my clients) and download them to my computer?

    And if that's not enough to ask, I'd also like some sort of alert so I know when it happens.

    Thanks,
    Dave

    Posted 19 years ago #

  • Jim Matthews Administrator

    You could run an AppleScript that periodically looks for new files and downloads them. Would you want the files deleted after they are downloaded, or moved into another folder on the server?

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 19 years ago #

  • dvandelay Member

    Thanks for the quick response. Moving the files to another folder would be a nice option.

    -Dave

    Posted 19 years ago #

  • Jim Matthews Administrator

    Here's a script that should do what you want. You need to paste it into Script Editor and save it as an application that stays open. Right now it it's written to check for new files every 15 minutes; you can change that by editing the next to last line.

    You need to edit the first line so that it has the URL for the folder you are interested in. You can put the password between the colon and at-sign, or leave it out if you want Fetch to get the password from the keychain.

    I hope this helps,

    Jim Matthews
    Fetch Softworks
    --
    property sourceURL : "ftp://userid:@host/path/"
    property downloadedFilesFolderName : "downloaded"

    on downloadAndRenameFiles(theURL)
    tell application "Fetch 4.0.3"
    open url theURL
    refresh file list transfer window 1
    if not (exists remote file 1) then return
    if not (exists remote directory downloadedFilesFolderName) then
    make new remote directory at beginning with properties {name:downloadedFilesFolderName}
    end if
    set fileNameList to name of every remote file
    set dialogMessage to "The following files have been downloaded: " & return
    repeat with aFileName in fileNameList
    set aFileNameString to (aFileName as string)
    download remote file aFileNameString
    set name of remote file aFileNameString to (downloadedFilesFolderName & "/" & aFileNameString)
    set dialogMessage to dialogMessage & return & aFileNameString
    end repeat
    display dialog dialogMessage
    end tell
    end downloadAndRenameFiles

    on idle
    downloadAndRenameFiles(sourceURL)
    return 15 * 60 -- run again in 15 minutes
    end idle

    Posted 19 years ago #

  • dvandelay Member

    Thank you!

    This is the best support I've ever received for any software (or anything else for that matter).

    -Dave

    Posted 19 years ago #

  • Jim Matthews Administrator

    You're welcome! We need more example scripts, and your question was a good excuse to write one :).

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 19 years ago #

Topic closed

This topic has been closed.