1.

Solve : Creating Directories & Subdirectories at once?

Answer»

Hello, I would like to know how to create a tree consisting of directories and subdirectories using ONE command instead of MKDIR and using cd to GO in and create them individually.

example

mkdir A B C D would create the directories

is there a way to create sub directories in one command line


A B C D folders

Within A there's filea fileb filec

Within B there's filed filee filef

etc


Thanks Quote from: Reta on DECEMBER 15, 2010, 08:33:20 PM

Hello, I would like to know how to create a tree consisting of directories and subdirectories using one command instead of mkdir and using cd to go in and create them individually.
example
mkdir A B C D would create the directories
is ther a way to create sub directories in one command line
A B C D folders
Within A there's filea fileb filec
Within B there's filed filee filef
etc
Thanks

I will make a guess at what your want. Once we know what you want, it is easy.
Let';s suppose that yew want any umber of directories from the root with names that have no special chars or spaces.  Likewise for sub directories.  But sub dirs are created across all the root directories. With the given names. And each sub dir can have a number of empty TXT files with given names. Repeated inn each sub directory.

Is that close?
Quote from: Reta on December 15, 2010, 08:33:20 PM
Hello, I would like to know how to create a tree consisting of directories and subdirectories using one command instead of mkdir and using cd to go in and create them individually.

example

mkdir A B C D would create the directories

is there a way to create sub directories in one command line


A B C D folders

Within A there's filea fileb filec

Within B there's filed filee filef

etc


Thanks

yes you can, assuming you are using BASH
Code: [Select]mkdir -p directory/file{a..g} #make directories from filea to fileg


Discussion

No Comment Found