1.

Solve : MS DOS batch file renaming folder using date?

Answer»

How can I get a batch file to rename a folder USING YESTERDAY's date as the new folder name? This must be a homework QUESTION! It seems to be popping up everywhere.

You need to

1. Find out today's date.
2. If the day number is greater than 1, subtract 1 from it. Keep the month and YEAR number the same. Go to step 8.
3. If the day number is 1, subtract 1 from the month.
4. If last month was 4, 6, or 11, make the day number 30
5. If last month was any of the others except 12 or 2, make the day number 31.
6. If last month was 12, make the day number 31, and the year number 1 less.
7. If last month was 2, check if the year is a leap year. If yes, make the day number 29. If no, make it 28.
8. Assemble the day,  month and year numbers into your local date format. Pad with zeroes as required.
9. Use this STRING to rename the folder.




Discussion

No Comment Found