Page 1 of 1

Parameter for FTP username and password

Posted: 04 Dec 2009 11:11
by gmazza
Hey there,
I was wondering if it is possible to have a parameter passed for the username and password for my ftp batch job.
Here is my ftp login script:
username (obviously I put my username here)
password (obviously I put my password here)
ascii
prompt y
cd Training\Export

mget 45*.*
mget 62*.*
bye

It all works fine but I have tons of these scripts doing many things and if the password changes for the ftp site, then I need to go in ALL these scripts and change the password to the new one.
Is there anyway I can have 1 txt file storing the username and password, then when the password changes, I only need to change the one file with the new password.
Thus when calling my login script, I can pass the username and password from the stored txt file.
Is this possible??
Thanks for your help in advance!!

Posted: 06 Dec 2009 03:50
by DosItHelp
gmazza,

This may work for you:
Use the FTP -s option for your shared login script and at the same time pass the 'real' ftp script (login sequence removed) in via input stream.

Code: Select all

ftp -i -s:"loginsequence.txt" <realftp1.txt
ftp -i -s:"loginsequence.txt" <realftp2.txt
...
Or better try the (newly added :wink:) batch with embedded ftp described here:
http://www.dostips.com/DtTipsFtpBatchScript.php#Batch.FtpBatchLoginSharing
and simply call:

Code: Select all

FtpLogin.cmd realftp1.txt
FtpLogin.cmd realftp2.txt
...

Hope this helps.