Go Back   Computer Forums > General Computing > Hardware
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 08-06-2004, 09:34 AM   #1
Beta Member
 
Join Date: Aug 2004
Posts: 2
Default Batch file to rename a file to ddmmyy.txt

I am trying to write a batch file that will be scheduled to run once daily in order to rename a constantly growing datafile to ddmmyy.txt. I would like to use the DOS system DATE variable but need to know how to manipulate the string from dd/mm/yyyy format to ddmmyy. Is there an easy way of doing this or can somebody point me in the right direction?
__________________

nortyrich is offline   Reply With Quote
Old 08-06-2004, 09:52 AM   #2
In Runtime
 
0x54's Avatar
 
Join Date: Jul 2004
Posts: 157
Default Re: Batch file to rename a file to ddmmyy.txt

id be use python or perl |: simply because i dont know how to do it in dos
__________________

0x54 is offline   Reply With Quote
Old 08-06-2004, 11:46 AM   #3
Beta Member
 
Join Date: Aug 2004
Posts: 2
Default

I've managed to solve this now, just by using the same syntax as described in the SET command help as follows

@Echo off
SET dd=%date:~0,2%
SET mm=%date:~3,2%
SET yy=%date:~8,2%
SET ndate=%dd%%mm%%yy%

REN c:\datafile.txt "l"%ndate%".txt
nortyrich is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 10:32 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0