Computing.Net > Forums > Programming > Renaming file with create date

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 file with create date

Reply to Message Icon

Name: hrodriguez411
Date: March 4, 2009 at 05:46:03 Pacific
OS: Windows XP
CPU/Ram: intel 2.4
Product: Hewlett-packard / P5700
Subcategory: Batch
Comment:

I am trying to append the create date to a txt file as ddmmyyhhmmss. But instead I get mmddyyyyhhmm. Can someone please help me with the format. thanks

this is what I have so far:
Echo off
for %%I in (test.txt) do (
for /F "tokens=1-6 delims=/-: " %%A in ("%%~tI") do (
set CRDATE=%%A%%B%%C%%D%%E
set CRTIME=
)
)
ren test.txt test_%CRDATE%_%CRTIME%.txt



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: March 4, 2009 at 07:31:51 Pacific
Reply:

You're not going to get seconds; FOR just doesn't give you that information (nor does DIR). VBScript will, but you're not using VBScript.

If month and day are in the wrong order, just swap %%A and %%B.


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: Renaming file with create date

Renaming file with create date VBS www.computing.net/answers/programming/renaming-file-with-create-date-vbs/18111.html

Deleting files based on Date www.computing.net/answers/programming/deleting-files-based-on-date/15215.html

renaming files with cdate www.computing.net/answers/programming/renaming-files-with-cdate/16303.html