Ignore entire folder using du -I

command lineunix

I tried to ignore an entire subfolder of the current folder when running du:

du -I=./subfolder -sh

This, however, gives me the grand total size of the current folder as if the -I never worked. I read from manpage that:

-I mask
Ignore files and folders matching the specified mask.

So it's supposed to work with folders.
But all the examples that I found online specify simple globs like -I="*.txt".

Is it that the folder must take on a specific form instead of a plain relative path?

Best Answer

Found the problem myself:

The single-dash option -I does not accept =. The convention is that double-dash options -- require =.

I fixed by using -I ./subfolder instead.