Finding empty directories
bash, directory, unix
Solution
Check whether `find <dir> -type f` outputs anything. Here's an example:
for dir in A B C; do
[ -z "`find $dir -type f`" ] && echo "$dir is empty"
done
Problem
I need to find empty directories for a given list of directories. Some directories have directories inside it. If inside directories are also empty I can say main directory is empty otherwise it's not empty. How can I test this? For example: ``` A>A1(file1),A2 this is not empty beacuse of file1 B>B1(no file) this is empty C>C1,C2 this is empty ```