Your best friend for file transfer.

Fetch application logoFetch

automating fetch (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 20 years ago by tomklein
  • Latest reply 20 years ago from Jim Matthews
  • tomklein Member

    i need to download and clear 2 folders from an ftp site: i want to look for shortcuts in a folder on the desktop (to make things easy to reconfigure), download the directories that they point to into a local folder, and then delete the contents of those directories on the server (but NOT the directories themselves).

    i can't figure out how to extract the url from inside a shortcut. (telling fetch to open the shortcut file connects me to the directory, but then i have to process the fetch window line by line rather than just COPYing the whole directory.)

    likewise, i can't find a command that performs the equivalent of "select all elete".

    any and all help would be appreciated.

    Posted 20 years ago #

  • Jim Matthews Administrator

    This is trickier than I thought. Here's what I came up with:

    tell application "Fetch 4.0.3"
    open {alias "PBG4:Users:jmatt :Desktop:Unit shortcut"}
    repeat until (status of transfer window 1 is "Connected.")
    delay 1
    end repeat
    set curdir to current directory of transfer window 1
    set parentdir to parent directory of transfer window 1
    set current directory of transfer window 1 to parentdir
    duplicate remote directory curdir of transfer window 1 to alias "PBG4:Users:jmatt :Desktop:foofolder:"
    set current directory of transfer window 1 to curdir
    delete every remote file
    end tell

    The tricky things are:

    1) You have to wait for the window status to be "Connected." in order to know it's safe to proceed. If, instead of opening a shortcut, you said "open url "ftp://userid :password@hostname/path/"" Fetch would take care of that for you.

    2) You can't download the folder that the shortcut points to while you are in that folder. So you have to temporarily go to the parent folder, and then return after the download.

    Let me know if this doesn't work for you.


    Jim Matthews
    Fetch Softworks

    [This message has been edited by JimMatthews (edited 10-06-2003).]

    Posted 20 years ago #

Topic closed

This topic has been closed.