Another approach is use the tree
which is pretty handy and navigating directory trees based on its strong options. There are options for directory only, exclude empty directories, exclude names with pattern, include only names with pattern, etc. Check out man tree
Advantage: you can edit or review the list, or if you do a lot of scripting and create a batch of empty directories frequently
Approach: create a list of directories using tree
, use that list as an arguments input to mkdir
tree -dfi --noreport > some_dir_file.txt
-dfi
lists only directories, prints full path for each name, makes tree not print the indentation lines,
--noreport
Omits printing of the file and directory report at the end of the tree listing, just to make the output file not contain any fluff
Then go to the destination where you want the empty directories and execute
xargs mkdir < some_dir_file.txt