|
|
Subject:
Batch file to rename files with date in Windows XP
Category: Computers > Operating Systems Asked by: jacksonmarbach-ga List Price: $10.00 |
Posted:
28 Sep 2003 05:00 PDT
Expires: 03 Oct 2003 03:22 PDT Question ID: 260920 |
As part of my regular backup routine, I zip up the contents of various directories into files called backup.zip, eudora.zip and attachments.zip. What I want to do is have a batch file that will rename those files automatically by appending the date at the front of each file name in the format of yymmdd. For example: 030928 backup.zip 030928 eudora.zip 030928 attachments.zip This is important because I want to store different backups of different dates on the same backup web site and the same backup CD. I have seen programs on the web like ND, wmd2fn and fdate. But all of them seem to replace the filename with the date instead of appending the date in the format I want to the front of the filename. I have also looked at the help in a dos window and I can see that %date% is a variable which I might be able to use. But I can't work out either how to write it into a dos REN command, or how to have the date temporarily formatted in the six-digit format I want without permanently changing the way dates appear in windows. What I'd like is a dos batch file where I can run program \directory\*.* and it will rename all files in the directory in the way I want. |
|
There is no answer at this time. |
|
Subject:
Re: Batch file to rename files with date in Windows XP
From: 1salz-ga on 28 Sep 2003 15:01 PDT |
How are you currently doing the zip operation? I created a script to zipping` |
Subject:
Re: Batch file to rename files with date in Windows XP
From: 1salz-ga on 28 Sep 2003 15:07 PDT |
I apologize for partial comment ... I was telling about a script that I created to zip various folders on my drives. What to archive .. is managed in an MS Access database where one can specify ANY number of source folders and the target location for their archive. I used winzip for compressing - but can change it to anything you feel comfortable. The archived/zip files are stored as dated files (as you mentioned). I am using this script to do scheduled backup of my work folders. Let me know if you are interested. |
Subject:
Re: Batch file to rename files with date in Windows XP
From: jacksonmarbach-ga on 28 Sep 2003 17:43 PDT |
Thanks, but it sounds a bit too complicated to use an access db. I'd rather have a simple batch file where I can see what it's doing. |
Subject:
Re: Batch file to rename files with date in Windows XP
From: 1salz-ga on 29 Sep 2003 09:28 PDT |
What if I give you a simple batch file that takes in same input as you mentioned in your original question (e.g. C:\archive\*.*) and rename all files in there to something like this: backup20030928.zip eudora20030928.zip Is this acceptable? |
Subject:
Re: Batch file to rename files with date in Windows XP
From: jacksonmarbach-ga on 30 Sep 2003 04:14 PDT |
Yup, I'd be happy with batch file whose outcome renamed files I specify including wildcards with oldname.20030929.oldextension. That would be good. |
Subject:
Re: Batch file to rename files with date in Windows XP
From: kdrguy-ga on 01 Oct 2003 13:25 PDT |
Use a utility called ANT from ant.apache.org Ant is really designed to build and compile programs written in Java. However it has many features for filesystem manipulation. I bet you can write an ant build script to do what you want. |
Subject:
Re: Batch file to rename files with date in Windows XP
From: jacksonmarbach-ga on 03 Oct 2003 03:22 PDT |
Well, thank you all for your suggestions. In the meantime I've also done some searching of my own and I've found the program that does exactly the right thing: it creates a simple date parameter called %dosdate% which is the date in the format YYMMDD. The program is called dosdate.exe and it's to be found at http://64.85.16.166/adb/adbins.htm I don't know whether I should pay the $10 to 1salz-ga. I'd be happy to but he or she didn't get back to me with the file he offered, and in the meantime kdrguy came back with a different file but in the form of a comment rather than an answer. I'd like to do the right thing here -- I'm going to close the question to further answerers now and then see what options Google offers me. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |