Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Renaming file with date

Status
Not open for further replies.

dimplekv

Programmer
May 21, 2001
7
US
How do I rename a file 'abc.txt' to 'xy_061301.txt'
where 061301 is the date of the system in 6/13/01 format.

I need to run a batch file which renames the file.

Thanks in advance.
 
Im not sure or your question, but you cannot insert "/" characters in a file name.

If you wanted to rename it without separators..just do:

ren abc.txt xy_061301.txt

Good luck..
 
Thanks for the reply, but I need to run the batch file which would rename the file from abc.txt to xy_ddmmyy.txt where ddmmyy is the system date.
 
Post your e-mail address and I will send you a sample bat where we parse the system time into a usuable variable in a command. You will be able to use the same technique to do the date. I tried to post it in this window but the format went haywire.
 
Thank You!
my email is dimplekv@yahoo.com.
Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top