Computing.Net > Forums > Disk Operating System > FTP Batch Files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

FTP Batch Files

Reply to Message Icon

Name: Matt
Date: November 27, 2003 at 09:03:50 Pacific
OS: Win XP
CPU/Ram: 1.6GHZ 256 RAM
Comment:

Is it possible to pass a parameter from one batch file to another whilst using the ftp command?

E.g.

Batch1.bat

ftp -i -s:C:\batch2.bat

Batch2.bat

open 199.000.011.99
username
password
quote site namefmt 1
cd /qdls
cd general/
del file1.txt

The batch files are working fine but I want to pass a parameter from batch1 to batch2. This parameter will then replace file1.txt so it will be deleted every time the batch is run. If you need more clarity or explanation, let me know. Thanks in advance.

Matt



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: November 27, 2003 at 14:10:39 Pacific
Reply:

I am not very expert of the ftp command, but as far as I know what you define a batch script (Batch2.bat) is really a trxt file of ftp command to be interpreted by the ftp commands itself and NOT by the system processor Cmd.exe or Command.com (in fact it is a ftp script not a batch file and the extension is not relevant at all).

So stated you can work around following this trick:

Omitt from Batch2.bat the last line (Del File1.txt) and set Batch1.bat as below

Echo Del %1 >> Batch2.bat
ftp -i -s:C:\Batch2.bat
Type Batch2.bat | Find /V "Del" > Batch2.bak
Del Batch2.bat
Ren Batch2.bak *.bat

If so typing Batch1 File1.txt will result in performing what you want. Adjust the pathnames as required.

May be some other guy is smarter than I can.


0

Response Number 2
Name: IVO
Date: November 27, 2003 at 14:16:34 Pacific
Reply:

Replace Del with del in Batch1.bat, as ftp commands are lowercase as standatd.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: FTP Batch Files

FTP batch file www.computing.net/answers/dos/ftp-batch-file/4647.html

Ftp Batch file www.computing.net/answers/dos/ftp-batch-file/2551.html

DOS Batch file to FTP files from UNIX www.computing.net/answers/dos/dos-batch-file-to-ftp-files-from-unix/2105.html