Another approach is to use a fairly convenient tree and navigate directory trees based on its powerful options. There are options for a directory only that exclude empty directories, exclude names with a picture, include only names with a picture, etc. Check man tree
Advantage : you can edit or browse the list, or if you make a lot of scripts and often create a package of empty directories
Approach : create a list of directories using tree , use this list as an argument for input to mkdir
tree -dfi --noreport > some_dir_file.txt
-dfi lists only directories, prints the full path for each name, causes the tree not to print indent lines,
--noreport Allows you to print a file and directory report at the end of the tree list, just so that the output file does not contain fluff
Then go to the destination where you want the empty directories and do
xargs mkdir < some_dir_file.txt
brother-bilo May 13 '19 at 20:14 2019-05-13 20:14
source share