Discussion Locked

Copy Utils??

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Does anyone know of a utility that will allow me to copy a file from one location to another that will append the date to all of the copied files?
For example:
Copy c:\file.txt d:\file'current date'.txt that would create d:\file140202.txt

I can't find anything on the reskit.

Cheers,
Wayne.

6 replies

by shanghai sam

Thanks for the link. I've installed the software and went through it. Unless I'm missing something I can't get it to insert the current date (without actually typing in the current date in my rule). Am I missing something?

by joseph moore

Well, I can get this to work for you in a 2-line BAT file (sounds like a game show!)
First, download a little utility from Microsoft called NOW.EXE. It is in the Resource Kit, but you can get it for free from them at:
http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/now-o.asp
(please remove any spaces)

Now, make a BAT file with the following 2 lines:
for /f "tokens=1-7 delims=: " %%i in ('now.exe') do set nowtest=%%i%%j%%k%%l%%m%%n%%o
copy c:\file.txt c:\file%nowtest%.txt

And you get a file with the file name of:
fileFriFeb151743442002.txt

I use this with a security camera in our server room to archive a picture it takes. I wanted to save the pictures by day/date/time down to the second. This does it.
The format is Day, Month, Date, Hour, Minute, Second, Year. You can change this around. The variables in the FOR line can be re-arranged. Here is how they line up:

%%i - %%j - %%k - %%l - %%m - %%n - %%o
Day - Month - Date - Hour - Minute- Second - Year

So, in the part of the IF TOKENS line, where it says DO SET NOWTEST= just arrance the %%variables as you want.

Hope this helps

This discussion is closed to new replies.