Skip to content

Instantly share code, notes, and snippets.

@JeanOlivier
Created October 27, 2021 21:05
Show Gist options
  • Save JeanOlivier/53838e08b5e59dc9af52e67fdc320959 to your computer and use it in GitHub Desktop.
Save JeanOlivier/53838e08b5e59dc9af52e67fdc320959 to your computer and use it in GitHub Desktop.
Get the total size of files with a specific extension
# Change the ./ and ".jpg" part to your own needs.
# The `| numfmt --to=si` part get human readable output, remove it to get a number of bytes.
find ./ -type f -name "*.jpg" -printf "%s\n" | gawk -M '{t+=$1}END{print t}' | numfmt --to=si
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment