Home / Microsoft / Microsoft DOS / roll over multiple directories with rename
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: roll over multiple directories with rename  (Read 422 times)
Claude Jones
Guest
« on: July 15, 2005, 06:05:01 PM »

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?
IP logged
Sidewinder
Guru



Thanked: 97
Posts: 4,340

Experience: Familiar
OS: Windows 7

« Reply #1 on: July 16, 2005, 06:00:36 AM »

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. 8)
IP logged

If you don't know where you are going, any road will get you there

                                                                            -Lewis Carroll
Claude Jones
Guest
« Reply #2 on: July 16, 2005, 10:36:00 AM »

Thanks a lot. Those pages look like the way to go with this.
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / roll over multiple directories with rename « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.09 seconds with 20 queries.