Skip to content

Instantly share code, notes, and snippets.

@607011
Created January 30, 2019 15:08
Show Gist options
  • Save 607011/fc034129ac05a92d7dbc328f0ee26e7d to your computer and use it in GitHub Desktop.
Save 607011/fc034129ac05a92d7dbc328f0ee26e7d to your computer and use it in GitHub Desktop.
Sum up file sizes
#!/bin/sh
fileglob=.
total=0
for size in $(ls -l ${fileglob} | tr -s ' ' | cut -d ' ' -f 5) ; do
total=$(( ${total} + ${size} ))
done
echo ${total}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment