Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add date/time to file when using ftp Get Command 1

Status
Not open for further replies.

EnergyTed

Programmer
Jan 27, 2005
68
GB
I would like to add the date/time to the end of a file using the get command.

"get file.rar B:\file(date/time).rar"

Can anyone advise if this is possible.



Kind Regards

 
Is this file going to be downloaded manually or in a script?
 
There are probably a couple ways you could do it, depending on what works best for you, but you'll use an ftp script, something like what is documented here:
From the same batch file, you'll need to work some magic to rename the file after you perform the GET. Here is a script I wrote to create a directory with today's date as the name, it should get you started in the right direction. Sorry I don't have the time to rewrite it for you:


echo %date% > temp.txt
for /F "tokens=1,2,3,4 delims=/ " %%1 in (temp.txt) do echo %%4-%%3-%%2 > temp2.txt
for /F %%1 in (temp2.txt) do mkdir %%1


Basically, you should be able to change the "mkdir" command to a rename command and be almost complete. You'll just need to also echo %time% to temp.txt and include the correct tokens in your FOR loop. Will probably take some experimentation to get it right.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top