Solved

Quick script - to create folders

Posted on 2006-11-30
5
1,298 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
Comment Utility
@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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
No Probs - Cheers Steve :)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now