ftp script question

  • Thread starter Thread starter walid faroun
  • Start date Start date
W

walid faroun

I have a simple ftp script such as the following
ftp -ivn
open ipaddres
user username password
cd /somedir
mget *
bye
My question is that this scrip work fine from the command
line, but if I run as a batch job I get to the ftp prompt
command line waiting for command. What do I need to make
it work. Thanks for the help in advance.
 
walid faroun said:
I have a simple ftp script such as the following
ftp -ivn
open ipaddres
user username password
cd /somedir
mget *
bye
My question is that this scrip work fine from the command
line, but if I run as a batch job I get to the ftp prompt
command line waiting for command. What do I need to make
it work. Thanks for the help in advance.

in the batch file do something like
ftp -ivn -s:c:\myftpscript.txt

where myftpscipt.txt contains the commands for the ftp session.
 
-----Original Message-----



in the batch file do something like
ftp -ivn -s:c:\myftpscript.txt

where myftpscipt.txt contains the commands for the ftp session.


Thanks for the help again - this now works, but
I have one more challenge and that is to pass a command
line argument to the myftpscript.txt file.
I tried but did not work. Help again. thanks
 
I have one more challenge and that is to pass a command
line argument to the myftpscript.txt file.
I tried but did not work. Help again. thanks

You can't pass anything to the ftp script file. You could write the ftp
script file from the batch file (dynamically create it), something like
this:

@echo off
echo o 127.0.0.1> c:\myftpscript.txt
echo user username password>> c:\myftpscript.txt
echo cd /somedir>> c:\myftpscript.txt
echo mget *>> c:\myftpscript.txt
echo bye>> c:\myftpscript.txt
echo quit >> c:\myftpscript.txt
ftp -ivn -s:c:\myftpscript.txt
del c:\myftpscript.txt

You can then customize whatever parameter(s) in the batch you need to. For
example:
echo user %1 %2>> c:\myftpscript.txt

where you'd call the batch like this:
myftp myname mypass
 
Back
Top