I need to create directory structure using mkdir
for directory creation and touch
for creating files using only relative paths.
1 Answer
Using bash brace expansion to create the directory structure:
$ mkdir -p mydir/{colors/{basic,blanded},shape,animals/{mammals,reptiles}} && \
touch mydir/{colors/{basic/{red,blue,green},blanded/{yellow,orange,pink}},shape/{circle,square,cube},animals/{mammals/{platypus,bat,dog},reptiles/{snakes,crocodile,lizard}}}
You can examine the directory structure with the tree
command.
code
.)-p
switch formkdir
to create path of folders.mkdir -p mydir/colors/basic
. Still You will have to do this few times to create entire structure.