I want to create an empty directory structure bar2
from a nonempty directory tree bar1
.
Both bar1
and bar2
are at the same hierarchical level. How can I use mkdir
in an efficient manner so that intermediate directories are automatically created?
- To create a directory list from bar1 with find and order it if necessary.
- Using
awk
, remove all branches from the list so that I can run `mkdir only on the leaves. - Run
mkdir
with the list to replicate the directory structure of bar1