Computing.Net > Forums > Programming > BATCH to copy and rename files

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.

BATCH to copy and rename files

Reply to Message Icon

Name: akira29krj
Date: April 9, 2007 at 20:31:45 Pacific
OS: WinXP pro
CPU/Ram: 2800+/1024MB
Product: self built
Comment:

I'm looking for a batch file to copy a specified folder to another directory and rename it to the current date and time. (04.10.2007.11.27PM) or something like that. Reason for the date and time is because this will be running every 10 minutes. So if someone could write me one real fast I'd greatly appreciate it. Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: April 10, 2007 at 03:06:04 Pacific
Reply:

Much depends on your date & time layout. Mine is:
Tue 10-04-2007
17:02:57.99

so this bat will do it:

::== DTfolder.bat
@echo off
setLocal EnableDelayedExpansion

set folname=%date:~10,4%%date:~7,2%%date:~4,2%%time:~0,2%%time:~3,2%
echo xcopy c:\mystuff x:\!folname!\
::==


=====================================
If at first you don't succeed, you're about average.

M2



0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: BATCH to copy and rename files

Batch file to copy and edit file www.computing.net/answers/programming/batch-file-to-copy-and-edit-file/16997.html

Batch file copy and Rename www.computing.net/answers/programming/batch-file-copy-and-rename/18689.html

Copy and Rename files with sequential number www.computing.net/answers/programming/copy-and-rename-files-with-sequential-number/19953.html