File Transfer Planet Forums » FTP Help and Tips
FTP batch file
(6 posts)-
Can anyone help me with an ftp batch file? The problem I am having is....How to get the batch file to automatically put in the user and the password?
Thanks in advance!
MattPosted 2 years ago # -
if you use the -s switch (in Windows anyway, not sure of other os's) followed by a : and a filename (with path) the batch will look in that file for the login information. the first line needs to be the user name, the second line is the password, subsequent lines can contain any ftp commands to be executed.
hope this helpsPosted 2 years ago # -
You should create two files: one ir an executable file the other is data file.
Let's cal them http://ftp.bat anf ftp (no extention)
http://ftp.bat will comntain:
ftp -s:ftp
ftp will contain:
open http://ftp.planet.com
user (put ur login username)
password (put ur login password)
ls
mget *.txt
lcd c:\temp
quit
Good luckPosted 2 years ago # -
I had one more question related to yours one for this example code: Shell ("c:\winnt\system32\ftp -n -s:c:\crms\crmps_rentals_mexico_monthend.ftp")
in a macro means??Posted 2 years ago # -
I usually write one .bat file that will create the command file then run the ftp using the commands in the file. Here's an example.
Replace anything within ~'s with your own information.
Hope this helps.
Echo ~UsrName~> ftpcmd.txt
echo ~myPass~>> ftpcmd.txt
echo binary>> ftpcmd.txt
echo prompt n>>ftpcmd.txt
echo mget *.exe>> ftpcmd.txt
echo bye >> ftpcmd.txt
ftp -s:ftpcmd.txt ~ftpAddress~
del ftpcmd.txtPosted 2 years ago # -
Posted 2 years ago #
-
I hope that someone can help me. I am new to writing batch files and I am not quite sure how to write the following code. Any help would be appreciated. I would like a batch file to connect to a server using ftp, then write a list of filenames from the ftp folder into a text file. The text file can either be written locally or in the ftp folder itself as long as I can get access to it. Please can someone help.
------------------------------------------------Posted 1 year ago #