On 19/01/2021 22:36, Maurice R Volaski wrote:
On 1/19/21, 4:49 PM, "Pádraig Brady" <pixelb...@gmail.com on behalf of p...@draigbrady.com> wrote:
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
> Do you think there is any way to do this action with du, then? Well du does not have an --include option. So it would be best to combine find with du for this. Something like: find -type f -name '*.dat' -print0 | du -a --files0-from=- cheers, Pádraig.