On 19/01/2021 17:31, Maurice R Volaski wrote:
> If I set globstar and use it as follows with exclude, the excluded
option is ignored. That is, the folder named “users” is descended into. Is that
the intended behavior? Is there a workaround?
>
> du -a --exclude=users **/*.dat
du will not recurse into dirs called 'users',
however your shell is doing the recursing
and specifying all the .dat files to du.
du will only ignore the last component of specified files.
To demonstrate:
$ echo **/*.dat
users/1/blah.dat users/2/blah.dat
$ du -a --exclude=users **/*.dat
0 users/1/blah.dat
0 users/2/blah.dat
$ echo **/users
users users/2/users
$ du -a --exclude=users **/users # All ignored
$ du -a --exclude=users users # All ignored