ftp script question

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.
 
P

Paul R. Sadowski

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.
 
G

Guest

-----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
 
P

Paul R. Sadowski

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

How to Call FTP from batch? 3
How to login in FTP (Client) from batch? 1
FTP Command Line 3
automate FTP 3
FTP scripts and password prompts 10
Batch FTP fails at one location 4
ftp problem 4
Batch FTP 4

Top