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: Maurice R Volaski
Subject: bug#45987: Why can't I exclude when using ** with du?
Date: Tue, 19 Jan 2021 22:36:24 +0000
User-agent: Microsoft-MacOutlook/16.36.20041900

Do you think there is any way to do this action with du, then?

On 1/19/21, 4:49 PM, "Pádraig Brady" <pixelbeat@gmail.com on behalf of 
P@draigBrady.com> wrote:

    CAUTION: This email comes from an external source; the attachments and/or 
links may compromise our secure environment. Do not open or click on suspicious 
emails. Please click on the “Phish Alert” button on the top right of the 
Outlook dashboard to report any suspicious emails.

    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]