help-bash
[Top][All Lists]
Advanced

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

Re: Sorting directories by size


From: Kerin Millar
Subject: Re: Sorting directories by size
Date: Tue, 24 Aug 2021 16:00:51 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 24/08/2021 15:49, hancooper wrote:
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, August 24, 2021 2:44 PM, Kerin Millar <kfm@plushkava.net> wrote:

On 24/08/2021 15:31, Dennis Williamson wrote:

On Tue, Aug 24, 2021, 9:26 AM hancooper <hancooper@protonmail.com
mailto:hancooper@protonmail.com> wrote:

     .

     Have got almost what I'd like, except that tho sizes are not in
     human readable form.

     find "$src" "${daggr[@]}" -type d -exec du {} + | sort -rn


Use du -h and feed it into the awk or gawk command in the stackoverflow
answer I linked in my recent message. And don't feed it any names
containing newlines.

Please, let's not. The commands I have been proposing from the outset
correctly handle arbitrary pathnames, provided that GNU coreutils is
available. They only need to be applied correctly rather than be mangled
into something else.

I like the `du` direction.  I have been wondering whether using `du -h0`
would create problems for sort because of the size letter.


It won't, provided that you have sort(1) act in accordance by using its -h parameter, as was specified. The reason I didn't specify this option from the outset was because I was initially unaware that you wanted to display the output of du(1) in addition to being able to properly process the pathnames.

--
Kerin Millar



reply via email to

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