I
I
Ivan Fedorov2017-05-26 18:01:00
cmd/bat
Ivan Fedorov, 2017-05-26 18:01:00

How to create BAT file with tricky MKDIR call?

How to create a batch file with such functionality: calling the mkdir command with the ability to create a tree of subdirectories in accordance with the list from a text file, in which the name of each new subdirectory starts on a new line, and each sublevel is indicated by an additional space before the name? I don’t remember when I had to write batch files, refresh, pliz, who remembers.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2017-05-27
@res2001

mkdir is capable of creating multiple nested directories at once, i.e.
mkdir dir1\dir2\dir3\dir4
if only dir1 exists, it will create the rest in one command.
But this is not your case.
If the file has a spreading tree, then one tricky call is indispensable.
Read the file line by line, parse the number of spaces before the name, create a directory in the right place.
This can be done in a batch file, but if you know vbs or js, then it's better to use them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question