ftp scripting

Discussion in 'OT Technology' started by backwiddavengeance, Jul 11, 2003.

  1. my newspaper is hosted off-site with a third party ISP, so we push our article and image content via FTP every night and throughout the day. I'm trying to combine our article (ascii) and image (binary) uploads into a single script; does anyone know if, under Windows 2000 using command line FTP, if I don't specify asc or bin, will the FTP client auto-determine and upload each file properly? or should I split the asc into one section of the script, and bin in another?
  2. SLED

    SLED custom title

    Sep 20, 2001
    Likes Received:
    i think it tries to guess, but i would split them up. I know it's guessed the wrong type for me on several occasions.
  3. crontab

    crontab Oracle doesn't have customers, they have hostages.

    Nov 14, 2000
    Likes Received:
    The command-line windows 2000 ftp client doesn't guess anything, it sends files in ascii format by default, you need to specify bin for binary mode.

    Here's how to perform a pseudo-batch ftp:

    At the command line type:

    C:>ftp -n -s:c:\temp\commands.txt hostname >> c:\temp\output.txt

    The -n flag is to not prompt you for a login, the -s:filename is the list of ftp commands you want to run.

    So within the commands.txt, you should have something like

    u username
    lcd /directory/where/images/are/to/upload
    cd /directory/where/images/are/to/be/placed
    mput *.jpg
    lcd /directory/where/docs/are/to/upload
    cd /directory/where/docs/are/to/be/placed
    mput *.xml

    Or whatever you need to do. Obviously this is pretty much a static batch, not too much dependencies you can throw in there. You're gonna have to determine what and where you need to put/pull ahead of time. Also this is a security risk as you can see.

    You will to figure out how to automate this with a third party util of some sort. Or get a 3rd party client with batch and scheduling capabilities.

    -crontab -l
    Last edited: Jul 11, 2003
  4. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Mar 14, 2000
    Likes Received:
    Vancouver, BC, CANADA
    You can could also use batch programming to create the script on the fly so if the files do change day to day you have a means to update the script. I use VB myself to do this.

Share This Page