How can I make empty directories from a text file.

English support forum

Moderators: Hacker, petermad, Stefan2, white

tony01
Junior Member
Junior Member
Posts: 35
Joined: 2003-09-13, 13:19 UTC

How can I make empty directories from a text file.

Post by *tony01 »

Hi :

Is there a way to make empty directories from a text file?

For example I have a text file with a list of empty directories to be created with total commander.

This is just an example of text file.

ListDir.txt:
-----------------
Books
Programs
Personal Info
Tools
Music
Microsoft
blabla
.
.

--------------------
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

Maybe you can edit the text file like this:
Books|Programs|Personal Info|Tools....
Copy the string, under TC press F7, paste the string, then all the directories will be created at once.
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

1. Create a text file with the following content:
Edit: Corrected!

Code: Select all

for /f "skip=2 delims=" %%a in (%1) do md "%%a"
2. Save it as "mkdirsfromlistdir.cmd" in Windows Folder.

3. Create a button with the following command:

Code: Select all

mkdirsfromlistdir.cmd
Drag&drop the file ListDir.txt to the button and the directories will be created. "skip=2" in the above example are the lines that are ignored in the text file so you need to adjust it if your directories don't start in line 3.

Icfu
Last edited by icfu on 2005-02-06, 16:45 UTC, edited 1 time in total.
This account is for sale
tony01
Junior Member
Junior Member
Posts: 35
Joined: 2003-09-13, 13:19 UTC

Post by *tony01 »

@Raymond:

It is a partial solution, because The strig to paste is limited to 256 characters,
therefore I can not create al directories that I want.

Anyone has another input????

TIA
tony01
Junior Member
Junior Member
Posts: 35
Joined: 2003-09-13, 13:19 UTC

Post by *tony01 »

@icfu:

It doesn't work.
I executed the process like you said , but it does nothing.

Any other input??


Thanks
chiron
Junior Member
Junior Member
Posts: 32
Joined: 2005-01-05, 15:42 UTC

Post by *chiron »

Hi

There is a german PlugIn for Speedcommander called "CreateFolder".
Look at
http://forum.speedproject.de/showthread.php?s=&threadid=2660.
Use UnSqueez to extract the sqx archive.

You have to embed the tool into TC via menu "Start/Change Startmenu".
Enter the Path to CF as "Command" and %p as parameter.
Rename the ending of your textfile to .clf and put it into the same dir als CF.
Now you can load the textfile with the "Favoriten" button of CF.

You can even scan an existing folder structure and save it as a favorite.

regards

chiron
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

@tony01:
Maybe you have created the button by dragging & dropping the mkdirsfromlistdir.cmd on the button bar? Then you will have a superfluous entry in the button "start path" which creates the folders in the folder where the "mkdirsfromlistdir.cmd" resides in. Delete the start path then!

Besides that: This example is made for dragging & dropping ListDir.txt (or any other file, it doesn't matter how you have named it) on a button with the mentioned command. It doesn't work when you just "run" the command or press the button with ListDir.txt marked. If you want other solutions just tell me. You can also have the folder creation started without dragging&dropping, I just need more input what exactly fits best for you... ;)

So, please follow the guidelines and it WILL work!

If it still doesn't work you are probably using Windows 98 or some other non NT system where not only the /f parameter is not supported but also the .cmd file extension can't be excecuted but only .bat.

Icfu
This account is for sale
tony01
Junior Member
Junior Member
Posts: 35
Joined: 2003-09-13, 13:19 UTC

Post by *tony01 »

@icfu:

I remove the superfluous entry in the button "start path" and I doesn't works properly.
This is my example :

This is the text file:
---------------------


Addison.Wesley.Professional.Effective.Enterprise.Java.Aug.2004
Addison.Wesley.Text.Processing.In.Python
Addison Wesley - Web Hacking - Attacks and Defense
Addison Wesley Just Java 2.6th Ed
Adobe.Acrobat.6.PDF.For.Dummies
Algorithms for Programmers

and this is the Empty Directories that It has been created (Result):
------------------------------------------------------------------------
Addison
Addison.Wesley.Professional.Effective.Enterprise.Java.Aug.2004
Addison.Wesley.Text.Processing.In.Python
Adobe.Acrobat.6.PDF.For.Dummies
Algorithms


Only 3 empty dir are correct, the rest I don't know what happend.
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Yep, I forgot the possibility of spaces in the file names when posting the code, sorry... ;)

So, please change the mkdirsfromlistdir.cmd file to the following:

Code: Select all

for /f "skip=2 delims=" %%a in (%1) do md "%%a"
Icfu
This account is for sale
tony01
Junior Member
Junior Member
Posts: 35
Joined: 2003-09-13, 13:19 UTC

Post by *tony01 »

@ICFU:

Good Job ICFU, Excellent!!!!!! It works like a charm.

Thank you very much for your Help!.

Cheers.

Tony
nimbus
Junior Member
Junior Member
Posts: 30
Joined: 2004-01-07, 22:31 UTC
Location: turkiye

Re: How can I make empty directories from a text file.

Post by *nimbus »

tony01 wrote:Hi :

Is there a way to make empty directories from a text file?...


ListDir.txt:
-----------------
Books
Programs
Personal Info
Tools
Music
Microsoft
blabla
.
--------------------
the other way (except tc)

1)open your text file with a "text editor" that supports column mode (ultra edit, textpad, pseditor)
2)add "md " (be carefull space) every start of lines (it is very easy using column mode. in ultra edit: column menu/insert_fill column)
3) save your text file as blahblah.BAT into where you want to create the a lot of directories.
4) run blahblah.BAT (enter, double click, whatever)
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Have you read the thread? Just wondering why you propose a manual solution to what the batch above does automatically. ;)
It reads the text file and runs "md line content" for each existing line.

Icfu
This account is for sale
nimbus
Junior Member
Junior Member
Posts: 30
Joined: 2004-01-07, 22:31 UTC
Location: turkiye

Post by *nimbus »

manual solution? what is the purpose? doing something fast or doing something automatically?
Have you read my thread? it wrote "the other way"?
is there any problem with writing "other ways".
I wrote my thread for the readers who dont like to spend their much times for complicated codes :wink:
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

It's not the other way but the same say only by manually editing.
Manually editing a file, entering md in each line (for which you need an advanced text editor which you have to start, too, and afterwards even saving it as a batch file and starting it is definetely not faster but slower than dragging&dropping to a button or even just pressing a button, that's rather obvious. How can you tell me that this could be faster?

There is nothing against the manual way when there are five lines in the batch file only but as soon as the file gets bigger you will feel like that a robot could do that stupid work much faster.

Icfu
Last edited by icfu on 2005-02-12, 13:08 UTC, edited 2 times in total.
This account is for sale
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

nimbus wrote:I wrote my thread for the readers who dont like to spend their much times for complicated codes :wink:
Who has to spend his time with complicarted codes with icfus solution? He spend his time to make the complicated (?) code work.

Thus you only once have to make a button, copy icfus code and then you will be able to make directories from each textfile without concerning what to add to the lines and which mode to use with what editor. Or even type it line by line.

And icfus command does the same as you propose. But automatically.

:roll:

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
Post Reply