Skip to content

Instantly share code, notes, and snippets.

View StefanHeng's full-sized avatar

Stefan Heng StefanHeng

View GitHub Profile
@StefanHeng
StefanHeng / dir_fl_count.sh
Last active April 24, 2022 18:48
Bash script for counting the number of files in each subdirectory
ls_fl_count () {
max_len=-1
for key in *; do
len=${#key}
((len > max_len)) && max_len=$len
done
pad=$((max_len + 5))
fmt="%-${pad}s %s\n"