Re: tree with dir size
On Thu, May 30, 2024 at 08:04:26PM -0400, eben@gmx.us wrote:
> > > It looks like "tree --du" should do it, but "tree -d --du -h" says
> > > ├── [452K] Documents
> I think "du -h -S -s Documents/" gives just the files in Documents, and not
> its subdirectories, and it gives 269M. "ls -ldh Documents/" says the
> directory itsely takes up 36k, so I'm not sure where "tree" got that number.
Hmm. Guessing again, it might be the sum of all the "-d" raw directory
sizes of the directory and its subdirectories, but still ignoring files?
I can't fathom why the programmer(s) decided to do this, because it
isn't useful to anybody, but it's the only answer I can come up with.
hobbit:~$ mkdir -p /tmp/x/y
hobbit:~$ tree --du -dh /tmp/x
[8.0K] /tmp/x
└── [4.0K] y
hobbit:~$ cp /vmlinuz /tmp/x
hobbit:~$ tree --du -dh /tmp/x
[8.0K] /tmp/x
└── [4.0K] y
Confusing and useless. I still don't have a better answer than this:
hobbit:~$ tree --du -Fh /tmp/x | grep /$
[7.8M] /tmp/x/
└── [4.0K] y/
Reply to: