Re: ftp via bat called by wsh

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Torgeir Bakken \(MVP\) (Torgeir.Bakken-spam_at_hydro.com)
Date: 01/12/05


Date: Thu, 13 Jan 2005 00:27:02 +0100

Kim wrote:

> I am ftping a directory of files using a bat file called from a wsh file.
>
> All is working fine with one exception.
>
> I cannot get the ftp command line to close when using MPUT - the ftp
> command to upload multiple files.
>
> It will work if I use PUT with one file.
>
> this is the contents of the bat file
> ftp -s:filename.txt myftpsite.com
>
> below are two version of the commands within the filename.txt referenced
> above..
>
> this will not work... It uploads no files and does not close the ftp
> connection.
>
> username
> password
> binary
> CD ecreditexperts
> CD www
> CD admin
> CD doc
> mput "D:\work_tasks\cpi_sales\sales\*.Doc"
> bye
Hi

This is because the mput command is default interactive (it will
ask for each file). This asking is what hangs your script.

You can suppress interaction for ftp.exe two different ways:

1)
Add -i to the command line, like this:

ftp.exe -i -s:filename.txt myftpsite.com

2)
In your filename.txt input file, add the command "prompt", like this
(the ftp command prompt toggles the interaction bit off and on each
time you run it, so be sure to add it only once in the file):

     username
     password
     prompt
     binary
     CD ecreditexperts
     CD www
     CD admin
     CD doc
     mput "D:\work_tasks\cpi_sales\sales\*.Doc"
     bye

-- 
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx


Relevant Pages

  • Re: FTP-ing files using vb6 codes
    ... All you need to do is refer to an FTP command list and implement the proper ... >> Veign's Resource Center ... >> Veign's Blog ...
    (microsoft.public.vb.general.discussion)
  • Re: launching JCL on MVS
    ... GET is an unknown command, althought it's what works in FTP command line... ... catch was the JCL had to be in the CWD. ... outputfilename holds the output of the job. ...
    (comp.lang.python)
  • Re: Updating via internet
    ... Thank you very much for your reply Danny. ... At present, if I want to publish an update I vpn the server, copy across the ... Dir command to check for the presence of the new FE). ... You can do an FTP command to ...
    (comp.databases.ms-access)
  • Re: ftp command
    ... The "rcp -p -r" command might be better for copying files back and forth if the machines are local and whatnot. ... Bob Booth - UIUC ... interface than the 'stock' ftp command. ... > the process am losing the permissions. ...
    (AIX-L)
  • Re: Booming or Fuming? Are You Alive? Or Are You Fading Away?!
    ... The single .cmd file which is a Command Library ... consists of ONLY scripting code using ONLY ... every detail of convoluted shell scripting command syntax. ...
    (microsoft.public.win2000.cmdprompt.admin)