1.

Solve : copy file and append datetime to filename?

Answer»

hi!

pls help. i need to COPY a FILE everyday to a different folder, then rename this copied file by appending the current date and time.

example:

copy filename.xls c:\newfolder\filename-datetime.xls

how do i do this?

thanks!Which OS are you using?
Pure Dos or Command line from which Windows VERSION?
That makes a BIG difference.

In generell you need the date, bring it in a variable which you can use for the new filename.

uliim using cmd on Windows XP.
im really not familiar with batch programming.

thanks in advance
Sorry I am not familiar with the xp cmd. Only with the NT cmd.
Try it on the Windows Forum. I am sure someone can give you a solution.


This is what I use. But in NT4.

The Date format the date /t command gives me is
Fr 23.09.2005. In the loop the it is filtered in: 23092005

FOR /f "TOKENS=*" %%a in ('date /t') do set date=%%a

echo %date:~3,2%%date:~6,2%%date:~9,4%


Good luck
uli



Discussion

No Comment Found