I have a batch script that dynamically creates some files and generates four files with somewhat random filenames based on the time, date, etc. It then needs to upload that file to a server via FTP.
As of right now, my .bat file has a line like “ftp -s:ftp.txt”. http://Ftp.txt contains some fairly straightforward FTP script stuff: something like this–
open ftp.myserver.com
username
password
put filename1.dat
put filename2.dat
put filename3.dat
put filename4.dat
What I’d like to do is pass in the filenames that need to be uploaded and then replace the “put filename1.dat” with “put %file1%”–where %file1% is the filename variable being passed in.
Is this possible? Anybody know how to do it? Or is my whole approach wrong?
You could generate the http://ftp.txt file on the fly with your bat file. Simply do something like :
Of course now that you are in the bat file you can use environment variables and other stuff in place of “filenameX.dat”
For example :