3 #=======================================================================
5 # File ID: 6a061bba-0014-11e5-8931-0d8802d731e4
7 # Create sorted list with number of directory elements in a directory
8 # tree. Useful to find directories with lots of files that need to be
11 # Author: Øyvind A. Holm <sunny@sunbase.org>
12 # License: GNU General Public License version 2 or later.
13 #=======================================================================
29 " -n "$progname" -- "$@
")"
30 test "$?" = "0" ||
exit 1
39 -h|
--help) opt_help
=1; shift ;;
40 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
41 -s|
--subtree) opt_subtree
=1; shift ;;
42 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
43 --version) echo $progname $VERSION; exit 0 ;;
45 *) echo $progname: Internal error
>&2; exit 1 ;;
48 opt_verbose
=$
(($opt_verbose - $opt_quiet))
50 if test "$opt_help" = "1"; then
51 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
54 Create sorted list with number of directory elements in a directory
55 tree. Useful to find directories with lots of files that need to be
58 Usage: $progname [options]
65 Be more quiet. Can be repeated to increase silence.
67 Count files in whole subtrees instead of single directories.
69 Increase level of verbosity. Can be repeated.
71 Print version information.
77 find "$@" -type d |
while read f
; do
80 if test "$opt_subtree" = "1"; then
81 echo $
(find |
wc -l) $f
83 echo $
(ls -a |
wc -l) $f