Created
June 7, 2016 15:30
-
-
Save bepcyc/64567b81c42db72f69b47dd6521e8931 to your computer and use it in GitHub Desktop.
To list immediate subdirectories containing greater than $NUM files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://superuser.com/questions/617050/find-directories-containing-a-certain-number-of-files/946283#946283 | |
# To list immediate subdirectories containing greater than $NUM files. | |
# if doesn't work try set $NUM explicitly | |
find -type f -printf '%h\0' | awk -v num="$NUM" 'BEGIN{RS="\0"} {array[$0]++} END{for (line in array) if (array[line]>num) printf "%s\n", line}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment