Solved

Quick script - to create folders

Posted on 2006-11-30
5
1,301 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:Pete Long
  • 3
  • 2
5 Comments
 
LVL 43

Expert Comment

by:Steve Knight
ID: 18044044
@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.
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 18044065
Suggest a way to get rid of it would be to share part way down the tree then map a drive to it and delete from there?

Shortening it to this:

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

Creates a directory structure all called 1\1\1\1\1 which allows more to be created... but still not 200
Steve
0
 
LVL 57

Author Comment

by:Pete Long
ID: 18044955
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?
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 18045338
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
0
 
LVL 57

Author Comment

by:Pete Long
ID: 18047140
No Probs - Cheers Steve :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
DOS command won't run from WScript.Shell 8 60
Capture New Directory and set variable 21 70
move command 5 62
how to pick file up from ftp via batch file 2 67
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question