Renaming directory's

July 30, 2009 at 06:41:00
Specs: Windows XP
Hi all,

I am trying to write a small script that creates a new folder (lets say test) with "MD function.

If NOT exist test MD test

But, if test exists i want to rename the directory to test_old

IF exist test REN test test_old
If NOT exits MD test

As I only started out recentely with batch programming I am not able to find out how to do the following.

when the test_old alreay exists I want to rename the current test folder to test_old2, so no directory's are deleted, only changed.

in short, she script needs to know what the last test_old(X) is and rename the current folder to test_old(X+1)

map structure should look like this
test
test_old1
test_old2
test_old3
.
.
.
test_oldx
test_oldx+1

the test folder is the folder wich is in use now.
the folders with the OLD suffix are folders wich aren't -used anymore but can't be deleted.

this script will be used to reset userprofiles

anyone can help regarding this?
thanks


See More: Renaming directorys

Report •


#1
July 30, 2009 at 07:18:34
nevermind, i found another way in doing this,
I added a timestamp and not a number. as the timestamp will be unique it does not need to be checked and this will be a lot easier to code

thanks anyway


Report •
Related Solutions


Ask Question