how can i create multiple directories?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Cryptonium
Junior Member
Junior Member
Posts: 3
Joined: 2003-12-22, 20:34 UTC

how can i create multiple directories?

Post by *Cryptonium »

Hi all,

I'm a new user to TC and I think it's an extremely useful program for arranging ones directories and files.

I have one question, how can I create multiple directories with one command?

I face this problem when I have some hundred files that I want to move to a different drive into mutiple directories. The solution I use currently is to open a command prompt into the target directory using TC and do a manual "md dir1,dir2,dir3,...etc."

I would like to use the built-in directory creator, but it doesn't recognize commas, semicolons, or anything as a separator for dir names.

Any help would be appreciated!
User avatar
Clo
Moderator
Moderator
Posts: 5731
Joined: 2003-12-02, 19:01 UTC
Location: Bordeaux, France
Contact:

Re: how can i create multiple directories?

Post by *Clo »

Cryptonium wrote:Hi all,

I'm a new user to TC and I think it's an extremely useful program for arranging ones directories and files.

I have one question, how can I create multiple directories with one command?

I face this problem when I have some hundred files that I want to move to a different drive into mutiple directories. The solution I use currently is to open a command prompt into the target directory using TC and do a manual "md dir1,dir2,dir3,...etc."

I would like to use the built-in directory creator, but it doesn't recognize commas, semicolons, or anything as a separator for dir names.

Any help would be appreciated!
:D Hello!
Welcome on board!
:roll: I think that the MD fonction in TC works rather as:
MD x:\dir\sub-dir\sub-sub-dir and so on... I tested, it's right.
In the Help, you can find a similar explanation:
"...You can now also create several subdirectories in one operation. Just separate the subdrectories with a backslash, e.g. directory1\directory2\directory3\. ..."
¤ I don't think that you could create several directories in a single operation.... Maybe with a plugin?
¤ However, since it's so long and irritating to create a lot of dirs. i.e. when installing in a new HD, you could write a batch file to create the most needed dirs. Name it: <anything.bat>. Place it in <windows> dir. Then, you launch it from a DOS / command-line box. Something like:

@echo off
md c:\My-images
md e:\My-music
md e:\My-movies
...... and so on...
exit


Then, you'll create sub-dirs in these dirs with TC easily!
Hoping that answers to your question,
8) Friendly regards,
Claude
Clo
#31505 Traducteur Français de TC French translator Aide en Français Tutoriels Français English Tutorials
Cryptonium
Junior Member
Junior Member
Posts: 3
Joined: 2003-12-22, 20:34 UTC

Post by *Cryptonium »

Thanks for your help.

I use TC most of the time to arrange my downloaded comics collection from usenet. Since these are mostly posted as single pages, I need to collect them into directories that contain complete issues.

I created a small batch file that can create a sequential set of directories (e.g. batman-001, batman-002,..etc) and it would be great if I can find a way to pass it the 3 parameters necessary to create the required dirs.

My script is one single line:

Code: Select all

for /L %%N in (0,1,6) do @mkdir batman-0%%N
If I can pass it the first number (0) and the last one (6), it can create the set of dir batman-001,...,batman-006.

I'm complete newbie in DOS scripting but I hope I can integrate this somehow in TC
Cryptonium
Junior Member
Junior Member
Posts: 3
Joined: 2003-12-22, 20:34 UTC

Post by *Cryptonium »

I think I solved my problem and I want to share it with the good people in this forum.

I created a DOS batch file that takes 4 parameters:

1. Destination dir
2. Start of the dir name
3. Start number
4. End number

Here's my batch file:

Code: Select all

:: Help
:: ajdir <target dir> <name> <start_num> <end_num>

for /L %%N in (%3,1,%4) do @mkdir %1\%2-0%%N
The I created a button in TC with the following parameters:

? %p %O

The first parameter just causes a dialog box to be shown with the 2nd and 3rd parameters and allows the user to add the starting and ending numbers of the sequence.

The second parameter add the current Source dir in TC, and the last one adds the name of the file currently selected without its extension.

The way it would work is that after I move my files to one directory, I can select one of the files and click on my button and then just fill the start and end numbers and all the required dirs will be created.

I hope this will be useful to people who use TC to sort their comics collection!
User avatar
Clo
Moderator
Moderator
Posts: 5731
Joined: 2003-12-02, 19:01 UTC
Location: Bordeaux, France
Contact:

Not expert too...

Post by *Clo »

Cryptonium
If I can pass it the first number (0) and the last one (6), it can create the set of dir batman-001,...,batman-006.

I'm complete newbie in DOS scripting but I hope I can integrate this somehow in TC
:) Hi again!
:( Unfortunately, I'm not an expert at DOS scripting... I used DOS (6.0-->
6.2) a lot, but wrote only so simple *.bat files (still useful!), the most complex were boot-menus... Now, this old PC is out of duty...
¤ You could try your sequence-line from the TC command-line (must be enabled in the Options >>Configuration >>Layout -default page when open-)
I hope that'll work properly!
Or else, you could use my old simplistic system... Remember: DOS names are 8.3! Or else, you'll get ~ in the name... Awful tildes!
:) Friendly regards,
Clo
#31505 Traducteur Français de TC French translator Aide en Français Tutoriels Français English Tutorials
User avatar
pdavit
Power Member
Power Member
Posts: 1529
Joined: 2003-02-05, 21:41 UTC
Location: Kavala -> Greece -> Europe -> Earth -> Solar System -> Milky Way -> Space
Contact:

Post by *pdavit »

From TC's help: "You can now also create several subdirectories in one operation. Just separate the subdrectories with a backslash, e.g. directory1\directory2\directory3."

Of course this isn't completely an automated process!

Now, for multiple file distribution on several different destinations the wish has already been made and now with the new tabbed system Christian has promised to consider it.
"My only reason for still using M$ Window$ as an OS is the existence of Total Commander!"
Christian Ghisler Rules!!!
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

An alternative way:
* Create a folder somewhere with some new empty folders with extensions .01 , .02 , etc. Keep this folder as a basis to create other empty folders.
* Select the empty folders you like (e.g. NewFolder.02, NewFolder.05, NewFolder.07)
* Copy these empty folders to the desired target folder and optionally change the names of the folders in the process.

Code: Select all

D:\TargetFolder\NewName.*
Image: http://img182.exs.cx/img182/6447/tcnewfoldersexample00000000001.png
Last edited by white on 2005-02-01, 19:24 UTC, edited 1 time in total.
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

white wrote:An alternative way:
* Create a folder somewhere with some new empty folders with extensions .01 , .02 , etc. Keep this folder as a basis to create other empty folders.
* Select the empty folders you like (e.g. NewFolder.02, NewFolder.05, NewFolder.07)
* Copy these empty folders to the desired target folder and optionally change the names of the folders in the process.

Code: Select all

D:\TargetFolder\NewName.*
Image: http://home.hccnet.nl/web.site/example/TC/New%20Folders/example.png
Would the asterik just copy the numbers then and nothing else in that spot?
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

Yes, only the extensions (which are the numbers) are put in that spot.
You did notice the dot, didn't you?
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

Yes, I noticed it but I'm not very DOS savy anymore. Been away from it too long I guess. ;)
User avatar
DarkKnight
Junior Member
Junior Member
Posts: 35
Joined: 2004-03-29, 19:53 UTC

Post by *DarkKnight »

Did you see the great solution in http://ghisler.ch/board/viewtopic.php?p=31623#31623 using 1\..\2\..\3\..\4 to create 4 dirs at once?
User avatar
Vochomurka
Power Member
Power Member
Posts: 814
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

http://ppro.totalcmd.net/Scripts/BatchMD.htm
Second time today I am posting this link :)
Single user license #329241
PowerPro scripts for Total Commander
User avatar
ado
Senior Member
Senior Member
Posts: 445
Joined: 2003-02-18, 13:22 UTC
Location: Slovakia, Pezinok

Post by *ado »

This is how I would do it:
If you want to create multiple directories, you can separate them with pipe, i.e. press F7 and type a|b|c - will create directories a, b and c.
If you want to create multiple directories too often, you can do this:
1. Create text file accessible via button bar with contents like a|b|c|b|d|e|f|g|h|....
2. Each time you need to create those sequential dirs, just open this file and paste its contents (or part) to F7 dialog
3. Then press Ctrl-(Num+) to select all and Ctrl-M to rename all those dirs as you wish incl numbers...

Obviously, this is going to work only when you are creating these new dirs in new empty directory. With little effort however you can handle also not empty dir

ado
User avatar
Vochomurka
Power Member
Power Member
Posts: 814
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

In this case I would suggest two batch files:
Way 1:

Code: Select all

for %%a in (DirOne DirTwo DirThree) do md c:\mypath\%%a
Of course, the list in parentheses (DirOne DirTwo...) can be made quite long (up to 200 chars approximately, if I am not wrong :? )
Way 2:

Code: Select all

md c:\mypath\DirOne
md c:\mypath\DirTwo
md c:\mypath\DirThree
This file can be made as long as you wish.
Single user license #329241
PowerPro scripts for Total Commander
xtrips
Junior Member
Junior Member
Posts: 12
Joined: 2003-08-22, 09:24 UTC

Batch create directories

Post by *xtrips »

Hello,

Can someone please build a command for me that:
- scans a directory for files (1 level depth)
- creates a sub-directory bearing the name of that file after it has removed the extension
- move that same file to its directory
- an so on to the next file


Thanks
Post Reply