Create multiple directories

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Haze
Junior Member
Junior Member
Posts: 11
Joined: 2003-10-02, 09:39 UTC

Create multiple directories

Post by *Haze »

Hello

I would like to know if its possilbe to create multiple directories in one go with the Make Dir command. I know I can create several folder by using the | sign.

For ex Folder1|Folder2 will create two new folders.

But I would like to create a more advance folder structure like this:

Main folder
Subfolder A
Folder1
Folder2
Folder3
Subfolder B
Folder1
Folder2
Folder3

Does anybody know if its possible?

Thanks for any help

Regards
Hans
User avatar
Flint
Power Member
Power Member
Posts: 3511
Joined: 2003-10-27, 09:25 UTC
Location: Belgrade, Serbia
Contact:

Post by *Flint »

Try this:
Main folder\Subfolder A\Folder1|Main folder\Subfolder A\Folder2|Main folder\Subfolder A\Folder3|Main folder\Subfolder B\Folder1|Main folder\Subfolder B\Folder2|Main folder\Subfolder B\Folder3

PS: But I really don't understand, why it is necessary to create them all in one step... :?
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 11.03 / Win10 x64
Haze
Junior Member
Junior Member
Posts: 11
Joined: 2003-10-02, 09:39 UTC

Post by *Haze »

Hi Flint

Thanks a lot for the lightning fast reply! It works perfect.

Yes, I guess a should explain why I need such an odd feature :-)

I'm working at a publishing company with AD and editors. For each new publication (issue) we need a new folder structure were we can drop and move files to. Normally we have to create all this folders by hand. Sometimes they end up different than the last one because it hard to remember how it looks like. Or we reuse an old folder structure and delete all files that are in the folders.

So your command line helped a lot :-)
User avatar
Flint
Power Member
Power Member
Posts: 3511
Joined: 2003-10-27, 09:25 UTC
Location: Belgrade, Serbia
Contact:

Post by *Flint »

Haze
Hm... I have somewhat similar situation, and I just packed my empty folder structure into an archive, and when I need it I just unpack this archive. ;)
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 11.03 / Win10 x64
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

You may use a Batch file e.g.:

Code: Select all

for /l %%i in (1,1,10) do (md folder%%i
			cd folder%%i
			md sub_a
			md sub_b
			md sub_c
			cd ..)
This batch creates 10 folders "folder1" to "folder10" with each three subfolders sub_a, Sub_b, Sub_c

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
Haze
Junior Member
Junior Member
Posts: 11
Joined: 2003-10-02, 09:39 UTC

Post by *Haze »

To Flint:
Oh, wonder why I never thought of that before :-) Trying to do things the hard way...
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3897
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

2Haze: Even a workaround to copy an existing folderstructure only:

1. Select the folder at source panel you want to copy
2. Set the other panel to the destination for the copied structure
3. Switch back to the source panel
4. Press F5 to show copy dialog
5. At "only files of this type" enter a not existing filename such as "xxxyyyzzz.qqqqqq"
6. Start copy ...

This will copy all files matching the file mask (none in this case) and their folders => this means folders only.
Done :D
#5767 Personal license
Haze
Junior Member
Junior Member
Posts: 11
Joined: 2003-10-02, 09:39 UTC

Post by *Haze »

Thanks sqa_wizard

I didnt know it was possible to do that with the simple F5 button. Thanks!
User avatar
StickyNomad
Power Member
Power Member
Posts: 1933
Joined: 2004-01-10, 00:15 UTC
Location: Germany

Post by *StickyNomad »

In as an alternative for entering a non-existing filename, you can also use TC's 'exclude-operator' "|".

Just enter " |*.* " in the copy-to dialog to exclude all contained files from copying...
User avatar
eugensyl
Power Member
Power Member
Posts: 564
Joined: 2004-06-03, 18:27 UTC
Location: România
Contact:

Post by *eugensyl »

Haze wrote:Hi Flint

Thanks a lot for the lightning fast reply! It works perfect.

Yes, I guess a should explain why I need such an odd feature :-)

I'm working at a publishing company with AD and editors. For each new publication (issue) we need a new folder structure were we can drop and move files to. Normally we have to create all this folders by hand. Sometimes they end up different than the last one because it hard to remember how it looks like. Or we reuse an old folder structure and delete all files that are in the folders.

So your command line helped a lot :-)
U can also DirCopy plugin for that but is so simple to put DIR, for example, in Type of files at F5 copy dialog.


Best wishes,
My Best Wishes,

Eugen
jordi.c
Member
Member
Posts: 109
Joined: 2006-02-18, 12:43 UTC

Post by *jordi.c »

Sheepdog wrote:You may use a Batch file e.g.:

Code: Select all

for /l %%i in (1,1,10) do (md folder%%i
			cd folder%%i
			md sub_a
			md sub_b
			md sub_c
			cd ..)
This batch creates 10 folders "folder1" to "folder10" with each three subfolders sub_a, Sub_b, Sub_c

sheepdog
HI sheepdog,

I'm totally a noob with using a batch....

Where Can I type your batch code in TC and what does %, md and cd;;) means?
Registered user #150595
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

jordi.c wrote:
Sheepdog wrote:You may use a Batch file e.g.:

Code: Select all

for /l %%i in (1,1,10) do (md folder%%i
			cd folder%%i
			md sub_a
			md sub_b
			md sub_c
			cd ..)
This batch creates 10 folders "folder1" to "folder10" with each three subfolders sub_a, Sub_b, Sub_c

sheepdog
HI sheepdog,

I'm totally a noob with using a batch....

Where Can I type your batch code in TC and what does %, md and cd;;) means?
1. Press Shift+F4 in TC (what opens a new file in the configured editor)
2. Inthe opening dialog insert a nem you like but with extension "CMD" or "BAT" e.g. Folder.cmd
3. Copy the text in the code box and paste it to the file.
4. Save the file.
5. Now you may doubleclick on the folder.cmd and in the current directory will ten folders with each three subfolders as described above.

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
jordi.c
Member
Member
Posts: 109
Joined: 2006-02-18, 12:43 UTC

Post by *jordi.c »

OMFG!!

This works awesome :)

Can you give me a little bit explanation of the codes you are using in the cmd file?

for /l %%i in (1,1,10) do (md folder%%i
cd folder%%i
md sub_a
md sub_b
md sub_c
cd ..)

So I can make them on my own for the future with appropriate name and if necessary subfolder names

Best Wishes!!
Registered user #150595
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

The "for" command is used to do operations with a set of files, folders or as in this case with counters. Just have a look in the Windows help for the word "for".

for /l => indicates, that you want to use a counter.
%%i => that defines a variable that contains the current value
in (1,1,10) defines that the counter starts by number 1, increases each time by 1 and ends up by 10
Use instead in (0,5,100) and you will see, how it works.
do introduces the commands that should be executed
( => indicates that you want to start a bunch of commands that do not end at the end of the line but at the closing bracket.

md Folder%%i => md is the DOS Command to make a directory Folder%%i is the name of the directory to make. the %%i will be substituted by the actual count of the loop. In this case by 1,2,3,4,5,6,7,8,9,10 or with the changed values (0,5,100) 0,5,10,15,20...100
Next line contains the next command

cd folder%%i => go into the folder that just has been created
md sub_a create a folder sub_a
md sub_b create a folder sub_b
md sub_c create a folder sub_c
cd .. go to the parent folder before the end of the set of commands.
) End of the command queue.
Now start the command queue with the next value.

If you don not use a batch file but type all those commands on the DOS prompt you have to use "%i" instead of "%%i". To use multiple commands on the DOS Prompt you could use the "&" to concatenate the commands

Code: Select all

for /l %i in (0,5,100) do md folder%i &cd folder%i&md sub_a&md sub_b&md sub_c&cd .. 
typed in one line on the DOS Prompt will create 21 folders with each 3 subfolders analogous to the batch file.


Hope that helps

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
jdo75
New Member
New Member
Posts: 1
Joined: 2007-06-04, 09:48 UTC

Subdirectories

Post by *jdo75 »

Hy!

I've got a similar problem: I do already have a directory structure with subdirectories for each year to archive documents. Now I do need to add the years coming. How do I achieve this?

structure:
client1 - documentation - 2003
client1 - documentation - 2004 ...
client2 - documentation - 2003...

Thanks in advance
Julian
Post Reply