Solved

Quick script - to create folders

Posted on 2006-11-30
5
1,300 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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Batch file to delete a folder 5 72
PDF-XChange Viewer Command Line for File -> Export -> Export as Image 2 502
Run MS Access Module from Macro / Bat File 9 88
file size 9 51
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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