Skip to content

Instantly share code, notes, and snippets.

@jspiro
Last active June 16, 2020 22:32
Show Gist options
  • Save jspiro/729e64e451d05ba3ce655a34cfb43d2a to your computer and use it in GitHub Desktop.
Save jspiro/729e64e451d05ba3ce655a34cfb43d2a to your computer and use it in GitHub Desktop.
horrific but working way to summarize file sizes in a directory for evaluating what's tracked by git lfs
$ find . -type f -name '*.*' |
sed 's/.*\.//' |
sort -u |
while read ext; do
(
gfind . -name "*$ext" -printf "%s\n" |
sed 's/$/+/' |
tr -d '\n'
echo 0
) | bc | tr -d '\n'
echo -e "\t$ext"
done
1003744 .exe
911328 .zip
806448 .dc
623008 .pck
564880 .mp4
497016 .d
351848 .efz
323112 .g
...
@kenthoward
Copy link

One little bug which probably didn't affect your results. When simplifying the extension extraction to just sed 's/.*\.//' the gfind -name test should have been updated to include a literal period.

gfind . -name "*.$ext" -printf "%s\n"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment