Your best friend for file transfer.

Fetch application logoFetch

mkdir, passive mode and scripting (2 posts)

  • Started 8 years ago by JImBrandt
  • Latest reply 8 years ago from Jim Matthews
  • JImBrandt Member

    Jim,

    I have three questions (I need to do all of these from an Applescript):

    1) How do I detect the existence of a folder on a remote location?

    2) How do I use MKDIR to create a new folder?

    3) Is there a way to force passive mode for a connection in a script?

    Are there examples of these?

    Number 3) is because I have a site that needs passive mode, but about one third of the time, times out getting the file list because of the active/passive settings. I'd like to connect to this site in passive mode in order to avoid the timeout.

    Jim Brandt

    Posted 8 years ago #

  • Jim Matthews Administrator

    Hi,

    1) To detect the existence of a remote folder you'd do something like this:

    tell application "Fetch"
    open url "ftp://username:@hostname/path/"
    set folderExists to exists remote folder "foobar" of transfer window 1
    end tell

    2) To make a new folder you'd do something like this:

    tell application "Fetch"
    open url "ftp://username:@hostname/path/"
    make new remote folder at beginning of transfer window 1 with properties {name:"foobar"}
    end tell

    3) To force passive mode:

    tell application "Fetch"
    set use passive mode to true
    end tell

    In general, if you want to know how to do something in AppleScript, click the Record button in Script Editor and then perform the action manually in Fetch. Script Editor will write a bit of AppleScript code for you.

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 8 years ago #

Reply

  • Or nickname, if you prefer.
  • This will be kept confidential.
  • This is to ensure that you’re a person, not a spambot.