Recursively counting files in a directory

find . -maxdepth 1 -type d -print0 | xargs -0 -I {} sh -c 'echo $(find "{}" | wc -l) "{}"' | sort -n

Leave a Reply

Your email address will not be published. Required fields are marked *