I am attempting to write a script which will ftp into a server a grab all files from a specific directory. Everyday the name of the directory I need to grab the files from changes based on the ftp servers system data.
Everything works fine with this script:
open ftp server user username password ascii cd /Some.Directory/03-03-2008 lcd C:\some.directory\ mget * mget * y y y y y y y y bye
I would like to pass a avarialbe to say something like this:
for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do set filedate=%%a-%%b-%%c
and then have my script look like this:
open ftp server user username password ascii cd /Some.Directory/%filedate lcd C:\some.directory\ mget * mget * y y y y y y y y bye
I am not sure how to go about getting this done. Please help.
One small bit of help. If you issue the command prompt before you issue mget, you will not need to reply Y to all the files.
create a batch file that contains this:
for /f "tokens=1,2,3 delims=/ " %%a in ('date /t') do set filedate=%%a-%%b-%%c echo open ftp server > ftpa1.cmd echo user username password >> ftpa1.cmd echo ascii >> ftpa1.cmd echo cd cd /Some.Directory/%filedate% > ftpa1.cmd echo cd C:\some.directory\ >> ftpa1.cmd echo cd prompt >> ftpa1.cmd echo mget * >> ftpa1.cmd echo bye >> ftpa1.cmd ftpa1.cmd