4

Hello I am running OS X.

I am trying to use du and the -I option to ignore all files of a given type. I am resorting to -I because OS X du doesnt include the "exclude" option.

Essentially I am trying to find the OS X equivalent to this command:

du -ah --exclude="*.txt" /directory/folder

Thomas Padilla
  • 193
  • 1
  • 1
  • 7
  • `du ... | sed '/.*\.txt/d'` ? Good luck. – shellter Sep 29 '15 at 21:14
  • Hmmm, ended up settling on a solution using find and awk: find directory/ -name '*.xml' -exec du -k {} \; | awk '{s+=$1} END {print s}' – Thomas Padilla Oct 12 '15 at 20:01
  • post your solution as an answer (with example output) and then accept it as the answer 48 hrs later (I think) to gain valuable reputation points! ;-) Use the `{}` formatting tool at the top left of the edit box for format data and code. Good luck. – shellter Oct 12 '15 at 22:37

1 Answers1

1

I had luck on MacOS 10.15 with the following:

du -I System -I private -I Library
JS.
  • 14,781
  • 13
  • 63
  • 75