mirror of
https://github.com/notwa/rc
synced 2024-11-05 08:29:02 -08:00
18 lines
452 B
Bash
Executable file
18 lines
452 B
Bash
Executable file
#!/usr/bin/env zsh
|
|
# YES_ZSH
|
|
# NO_BASH
|
|
# NO_DASH
|
|
|
|
dbusiest() { ### @-
|
|
### display the directory with the most files in it, counted recursively.
|
|
[ $# -le 0 ] || { printf "%s\n" "$0: too many arguments" >&2; return 1; }
|
|
local c d
|
|
for d in *(FDN); do
|
|
print $(find $d 2>/dev/null | wc -l) $d
|
|
done | sort -nr | while read c d; do
|
|
echo -E $c $d
|
|
done
|
|
[ -z $d ] && return 1
|
|
}
|
|
|
|
[ "${SOURCING:-0}" -gt 0 ] || dbusiest
|