kukris Posted January 24, 2006 Posted January 24, 2006 Hi everyone,I would like to create several folders in a row like 01, 02, 03 ... n. The batch command should stop after creating folder n. It would be also nice if I could specify a prefix for the folders. Can some please help to create such a batch file?Thanks in advanceKukris
Yzöwl Posted January 25, 2006 Posted January 25, 2006 (edited) Perhaps something along these lines may help@ECHO OFF &SETLOCAL ENABLEEXTENSIONSSET "n=14" &SET "prefix=backups_"FOR /L %%? IN (1,1,%n%) DO IF %%? LSS 10 (IF NOT EXIST %prefix%0%%? MD %prefix%0%%?) ELSE (IF NOT EXIST %prefix%%%? MD %prefix%%%?)ENDLOCAL &GOTO :EOFJust change the prefix from backups_ to your preferred choice and set your n to the appropriate value for the last number in the sequence, I used 14, for this example. Edited January 25, 2006 by Yzöwl
kukris Posted January 25, 2006 Author Posted January 25, 2006 Thank you alot.That is exactly what I was looking for.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now