I want to print the names of all subdirectories that contain zero files (they may contain subdirectories). The following works for the current directory:
$ ls -p | grep -v / | wc -l | \ xargs -I % test % -eq 0 && pwd
I think that there might be a more elegant solution, any suggestions? And how do I have to change it to recurse through all subdirectories?
I have a test structure: test/test1/test4 and test/test2/test3/test5. The only file is in test/test1. I want to run the command in the basis directory (test/). The results are supposed to be: test/ ; test/test2/ ; test/test2/test3/ because those are the directories that only contain subdirectories but no files. Additional accceptable would be the empty endpoints test/test1/test4/ and test/test2/test3/test5.