aboutsummaryrefslogblamecommitdiff
path: root/bin/cfr
blob: f5eafef57f22b9d346f0df5bef8c62f55b24941c (plain) (tree)
1
2
3
4
5
6
7
8
9
         
                                                                   
                         

                                                      
            

                
                       
                                                             
              
    
               
#!/bin/sh
# Count all descendants of given directories; don't follow symlinks
for dir in "${@:-.}" ; do
    if ! [ -d "$dir" ] ; then
        printf >&2 'cfr: %s: Not a directory\n' "$dir"
        ex=1
        continue
    fi
    printf '%u\t%s\n' \
        "$(find "$dir" -type d -exec cf -o -- {} \; | tot)" \
        "$dir"
done
exit "${ex:-0}"