Computing.Net > Forums > Disk Operating System > batchfile to copy files with datename

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batchfile to copy files with datename

Reply to Message Icon

Name: Simone Lang
Date: July 19, 2002 at 03:23:38 Pacific
Comment:

Hello, I want to regularly start a batchfile, that copies the same file every day and automatically changes the filename to the current date.
For example
Event.txt --> event020719
Event.txt --> event020720
Event.txt --> event020721

Does anyone know how to do that?
Thanks in advance
Simone



Sponsored Link
Ads by Google

Response Number 1
Name: Renaissance Man
Date: July 19, 2002 at 04:49:12 Pacific
Reply:

http://www.computing.net/windowsme/wwwboard/forum/27111.html


0

Response Number 2
Name: Simone Lang
Date: July 19, 2002 at 05:52:15 Pacific
Reply:

I forgot to say that I am not using Win98, but Win2000. The mentioned batchfile won't work on Win2000.

How do I have to change it, so it works on Win2000?

Simone


0

Response Number 3
Name: Renaissance Man
Date: July 19, 2002 at 06:16:21 Pacific
Reply:

Did you follow all the links in the post?

Did you read response 3 here?
http://www.computing.net/dos/wwwboard/forum/10290.html


0

Response Number 4
Name: Simone Lang
Date: July 19, 2002 at 06:41:51 Pacific
Reply:

I did. But that uses the time as the filename. I need the date as the filename. Any idea how to?


0

Response Number 5
Name: Simone Lang
Date: July 19, 2002 at 06:46:12 Pacific
Reply:

got it! Thanks


set date2=%date:~4,2%%date:~7,2%%date:~10,4%

rename file.txt %date2%.txt


0

Related Posts

See More



Response Number 6
Name: Bill Wilson
Date: July 19, 2002 at 20:22:40 Pacific
Reply:

very cool, that was exactly what I was looking for. I love when I come across a post that is what I need.


0

Response Number 7
Name: Secret_Doom
Date: July 19, 2002 at 20:54:49 Pacific
Reply:

I love when someone reads previous posts before posting a question answered a day ago.

BTW, there's another method, which I prefer (at the time I posted those replys on RMan's links, I didn't know about this method). This is all one line:

FOR /F "tokens=2,3,4 delims=/- " %a in ("%DATE%") do set CDATE=%a%b%c

If on a batch file, double the %'s from %a %b and %c (%%a %%b %%c).

It's longer, but more simple to read.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: batchfile to copy files with datename

how to copy files using date www.computing.net/answers/dos/how-to-copy-files-using-date/12582.html

How to copy files of certain date www.computing.net/answers/dos/how-to-copy-files-of-certain-date/14802.html

copying files with long filenames www.computing.net/answers/dos/copying-files-with-long-filenames/4586.html