Help with ftp BAT and DAT file
Results 1 to 5 of 5

Thread: Help with ftp BAT and DAT file

  1. #1
    Join Date
    Aug 2000
    Location
    Birch Tree, MO, USA
    Posts
    4

    Help with ftp BAT and DAT file

    I used to know this but...
    What's the procedure for having a BAT file ftp files by accessing a DAT file for the ftp commands. I seem to remember the BAT file command being something like:
    ftp -s:uploadinstructions.DAT www.yourdomain.com

    Then the DAT file format being something like:
    username
    password
    put filename1.html
    put filename2.html
    put imagename1.jpg
    etc
    etc
    bye

    but I've tried every variation I can think of and it's not working.

    Any help would be MUCHO apreciated by this old-timer.

  2. #2
    Join Date
    Feb 2000
    Location
    26.03°N 80.14°W
    Posts
    9,410
    Here are the contents of an example FTP (File Transfer Protocol) script file named foobar.ftp:
    • (Note: Do not use the line numbers on the left within the FTP script file. They are here so each line can be referred to in the brief description below)

    [list=1][*] user myusername mypassword[*] cd public_html[*] lcd c:\website\mydomain.com\public_html[*] hash[*] put filename.html[*] binary[*] put filename.jpg[*] cd files[*] lcd files[*] bell[*] mput *.zip[*] ascii[*] put filename.html[*] quit[/list=a]
    The DOS (Windows 9x) command needed to execute the above foobar.ftp script file:
    • ftp -n -s:foobar.ftp ftp.mydomain.com

    Breakdown of this DOS command:
    • ftp = Start the Windows 9x FTP (File Transfer Program) program
       
      -n = Suppresses auto-login upon initial connection
       
      -s:foobar.ftp = Specify the name of the text file containing the FTP commands (which in this case is foobar.ftp); the commands will automatically run after FTP starts
       
      ftp.mydomain.com = Specifies the host name (ftp.mydomain.com in this case) or IP address of the remote host to connect to

    Brief description of each line in foobar.ftp:
    [list=1][*] user myusername mypassword
    user = Send new user information
    myusername mypassword = My username and password
     [*] cd public_html
    cd = Change Directory on remote system
    public_html = name of subdirectory
     [*] lcd c:\website\mydomain.com\public_html
    lcd = Local system Change Directory
    c:\website\mydomain.com\public_html = name of directory
     [*] hash
    hash = Toggles printing a "#" for each buffer transferred
     [*] put filename.html
    put = Send one file. (Note: FTP's default is transferring ASCII (text) files)
    filename.html = the name of the file
     [*] binary
    binary = Set binary as transfer type
     [*] put filename.jpg
    put = Send one file
    filename.jpg = the name of the file
     [*] cd files
    cd = Change Directory on remote system
    files = name of subdirectory
     [*] lcd files
    lcd = Local system Change Directory
    files = name of subdirectory
     [*] bell
    bell = Beep when command completed
     [*] mput *.zip
    mput = Send multiple files
    *.zip = name of files (* = wildcard)
     [*] ascii
    ascii = Set ascii as transfer type
     [*] put filename.html
    put = Send one file
    filename.html = name of file
     [*] quit
    quit = Terminate ftp session and exit[/list=a]
    Quick overview of FTP commands:
    • To see FTP's brief description and command line parameters, type ftp -? at the DOS prompt.
       
    • To load FTP without logging on to a remote system, type ftp at the DOS prompt.
       
    • To see a list of available FTP commands, type help at the FTP "ftp>" prompt.
       
    • To see the brief description for a particular FTP command, type help command at the FTP "ftp>" prompt.
       
    • To quit FTP and return to the DOS prompt, type quit at the FTP "ftp>" prompt.
    Vernon Frazee, Microsoft MVP (Windows - Shell/User)

    Defenses Up!
    Tip: When prompted for a password, give an incorrect one first. A phishing site will accept it; a legitimate one won't.


    Inside Spyware: A Guide to Finding, Removing and Preventing Online Pests


    If you don't keep up with security fixes, your computer|network won't be yours for long.

  3. #3
    Join Date
    Aug 2000
    Location
    Birch Tree, MO, USA
    Posts
    4
    Vernon,

    Well, I tried it and on the DOS window I'm still getting the error message "error opening script file upload.ftp", then a whole list of commands...all of which I feel that I'm using correctly in my bat file.

    Here's the command line I'm using in the bat file:
    ftp -n -s:upload.ftp ftp.[mydomain].com

    and here's the contents of my upload.ftp file:

    user [username] [password]
    cd accounts
    hash
    put systemconfiguration.html
    binary
    put bgR.jpg
    bell
    quit


    (the [brackets] aren't being used, I just used them to in this example to replace the actual info of my file)

    I've checked, rechecked, and triple-checked all the syntax of both and everything's fine. All the files are in the same local directory. I'm at a loss. And ideas?

    Thanks

    [This message has been edited by Ancient_Tiger (edited 08-18-2000).]

    [This message has been edited by Ancient_Tiger (edited 08-18-2000).]

  4. #4
    Join Date
    Aug 2000
    Location
    Birch Tree, MO, USA
    Posts
    4
    Never mind. I tinkered around with it and got it to work.

    Thanks for the effor anyways!

  5. #5
    Join Date
    Feb 2000
    Location
    26.03°N 80.14°W
    Posts
    9,410
    Your server may be a little different. Try it like this:
     
    [list=1][*] Put the following in your update.ftp file:
     
    [username]
    [password]
    cd accounts
    hash
    put systemconfiguration.html
    binary
    put bgR.jpg
    bell
    quit
     [*] And change the command line to:
     
    ftp -s:upload.ftp ftp.[mydomain].com[/list=a]
    Also make sure that your upload.ftp file is either in the same directory as you are or else specify the complete path to it so the FTP.EXE program can find it.
     
    Another thing I'd do is logon in the interactive mode and check out the commands that are available on your server. To do that, simply do a ftp ftp.[mydomain].com at the DOS prompt, then enter your [username] and [password] when prompted. Once you land at the server's ftp> prompt, type remotehelp to see what's available. You can then usually do a remotehelp command name to see some brief help. After you've played around a bit with controlling the server in this interactive mode, (trying most of the commands), you'll have a better feel for exactly what needs to be in your upload.ftp script file. When you're done type quit (or bye) to logoff.
     
    You can also play around interactively with ftp on your local system by simply typing ftp at the DOS prompt. When you're done, type quit to return to DOS.
    Vernon Frazee, Microsoft MVP (Windows - Shell/User)

    Defenses Up!
    Tip: When prompted for a password, give an incorrect one first. A phishing site will accept it; a legitimate one won't.


    Inside Spyware: A Guide to Finding, Removing and Preventing Online Pests


    If you don't keep up with security fixes, your computer|network won't be yours for long.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •