1.

Solve : roll over multiple directories with rename?

Answer»

I have a SIMPLE task. I'm backing up a drive to a folder, 'today'
After the first day, I want to rename 'today' to 'yesterday' and create a new back up in 'today'
On the second day, I want to rename 'yesterday' to 'day3' and rename 'today' to 'yesterday' and create a new 'today'
On the third day, I want to delete 'day3', rename 'yesterday' to 'day3', rename 'today' to 'yesterday', and create a new 'today'
If I write a SIMPLETON batch file to do these tasks, it gives me an error saying the first folder I want to rename to ALREADY exists...
I guess DOS reads the entire file first and CHECKS for errors. Since it is being told to create a directory that already exists, it PRODUCES an error.
Is there any way to do this with DOS or do I need to use a different scripting language?
Before you delete day3 you have to empty it.

For what it's worth, the command processor does not check syntax errors until the line is executed. A better tool for any Windows machine is Windows Script. Think batch language on steroids. Check it out at:

http://www.microsoft.com/technet/scriptcenter/default.mspx

Hope this helps. Thanks a lot. Those pages look like the way to go with this.



Discussion

No Comment Found