Computing.Net > Forums > Windows XP > Renaming a file with a datestamp

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.

Renaming a file with a datestamp

Reply to Message Icon

Name: v9001715
Date: February 7, 2005 at 06:43:33 Pacific
OS: Win xp
CPU/Ram: Pentium
Comment:

Hello,
Im trying to rename a file using a batch file appending to it the current date e.g. test.txt ->
test07/02/2005.txt. My initial thought was to do the following -

set timestamp=%DATE%
ren c:\test.txt test%timestamp%.txt
The second line results in a syntax error.
Any help would be greatly appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: February 7, 2005 at 07:27:37 Pacific
Reply:

You can't use the / character in a filename so you need to replace the / with - so

set timestamp=%DATE%
set timestamp=%timestamp:/=-%
ren c:\test.txt test%timestamp%.txt


0

Response Number 2
Name: fin7
Date: February 7, 2005 at 08:42:33 Pacific
Reply:

Try this here it worked a treat for me. Its a dos program called NameDate. Download it from here.

http://www.informatics-consulting.de

Good Luck


0

Sponsored Link
Ads by Google
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 Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Renaming a file with a datestamp

How to rename a file with date/time www.computing.net/answers/windows-xp/how-to-rename-a-file-with-datetime/105340.html

rename file with folder name www.computing.net/answers/windows-xp/rename-file-with-folder-name/114886.html

can't share files with a mac www.computing.net/answers/windows-xp/cant-share-files-with-a-mac/87608.html