bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45987: Why can't I exclude when using ** with du?


From: Pádraig Brady
Subject: bug#45987: Why can't I exclude when using ** with du?
Date: Tue, 19 Jan 2021 21:49:16 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0

tag 45987 notabug
close 45987
stop

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

cheers,
Pádraig





reply via email to

[Prev in Thread] Current Thread [Next in Thread]