Link to home
Start Free TrialLog in
Avatar of Pete Long
Pete LongFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Quick script - to create folders

OK Guys

I need to replicate a users problem

to do so I need a script that will generate some folders

top level

1
  |
  |
   ------2
             |
             |
             ---------3

etc etc - all the way to 200 folders deep all nested inside each other

NB Why I'm doing this: A client has a folder like this that he cant delete - Ive told him to use RD /S and Killbox and Gipo Move on boot on the folder - no joy.
   I want to replicate the problem here but I don't want to manually create the folder structure
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

@echo off
c:
mkdir c:\startdir 2>NUL
cd \startdir
for /l %%a in (1,1,200) do mkdir %%a & cd %%a

Try this... goes down to 81 deep for me then fails.
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pete Long

ASKER

ah 84 folders will do - for now

Basically I wanted to see if

rd /s /q "startdir"

would delete them all and it did (up to 84 folders anyway) the client says his is 200 folders deep - so Im not sure why his WONT work - unless the path is too long for the command interpreter?
I think its the path limit, 255 chars I imagine.  As I suggested try creating a share further down or map a drive to part way down the tree and see if that works but yes the 81/84 seems to work fine!

Good luck

Steve
No Probs - Cheers Steve :)