help-bash
[Top][All Lists]
Advanced

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

Sorting directories by size


From: hancooper
Subject: Sorting directories by size
Date: Tue, 24 Aug 2021 16:36:43 +0000

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, August 24, 2021 3:00 PM, Kerin Millar <kfm@plushkava.net> wrote:

> 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

I can see that you use tab as delimiter between size and the directory name.





reply via email to

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