Find size of files

Wanted to get the size of files in a folder, in this particular case all the csv files, and came up with this after reviewing what others had done.

  • First find all the csv files in a particular location: find  *.csv
  • Then use xargs and run the du command with -c, --total -h, --human-readable
  • Take the last entry of the output: tail -1
  • Finally cut the first continuous word (field) out of that output: cut -f  -1

find *.csv | xargs du -ch | tail -1 | cut -f -1