tree and better recursive directory sizing

Bug #1813601 reported by Prasanna Loganathar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tree (Ubuntu)
New
Undecided
Unassigned

Bug Description

Currently `tree -dh`/`tree -h` simply shows the size of the directory nodes that tend to be 4K in a default ext4 installation with 4K block sizes. While this is not very useful in terms of UX, it does however have it's use by not spending a whole lot of IO on calculating recursive sizes. However, in addition to the current mode, it would be great to have an option, that recursively adds up the size of the its contents and displays the total size of the directory (inclusive of all hidden and dot files), instead of just the directory node size.

UPDATE: There's the "--du" option, that the upstream author was gracious enough to point out to me. This is great and solves the problem in theory.

But in practice, when used with large trees (for example the $HOME folder), the usefulness vanishes rather quickly due to the following reasons:

1. Output is usually very large. So, it isn't very practical to use this option in non-automated scenario. So we probably want to limit depth with "-L" in most occasions.

2. However, while using "-L", "--du" behaves in a way where it only calculates partial sizes for the leaf trees that are larger than the given depth. While this is probably the best default to have, with the exception of some specific scenarios where this is what is required, this limits it's practical usefulness as well with most large trees.

3. In the above scenario, the problem is compounded by the fact that one can easily be mislead, since there's currently no way to differentiate what's a partial size, and what's the correct real calculation of the full size.

POTENTIAL SOLUTIONS:

1 & 2. It would be nice to have an additional option that calculates the forces the tree traversal for the calculating sizes alone, so that real sizes are displayed when used along with the "-L" option. This can also be in the form of another depth, that default to say "-1", meaning a full traversal, or positive numbers for limiting the size traversals.

3. This can easily be solved by suffixing the size with something, for the sake of a better suffix "*".

ProblemType: Bug
DistroRelease: Ubuntu 18.10
Package: tree 1.7.0-5
ProcVersionSignature: Ubuntu 4.18.0-13.14-generic 4.18.17
Uname: Linux 4.18.0-13-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
ApportVersion: 2.20.10-0ubuntu13.1
Architecture: amd64
CurrentDesktop: GNOME
Date: Mon Jan 28 18:49:37 2019
Dependencies:
 gcc-8-base 8.2.0-7ubuntu1
 libc6 2.28-0ubuntu1
 libgcc1 1:8.2.0-7ubuntu1
 libidn2-0 2.0.5-1
 libunistring2 0.9.10-1ubuntu1
InstallationDate: Installed on 2019-01-01 (27 days ago)
InstallationMedia: Ubuntu 18.10 "Cosmic Cuttlefish" - Release amd64 (20181017.3)
SourcePackage: tree
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.apport.crashdb.conf: [modified]
mtime.conffile..etc.apport.crashdb.conf: 2019-01-15T04:51:59.517661

Revision history for this message
Prasanna Loganathar (pvl) wrote :
description: updated
description: updated
description: updated
summary: - tree and recursive directory sizing
+ tree and better recursive directory sizing
description: updated
Revision history for this message
Ian Bruntlett (ian-bruntlett) wrote : Re: [Bug 1813601] Re: tree and better recursive directory sizing

Hi,

On Wed, 30 Jan 2019 at 20:15, Prasanna V. Loganathar <
<email address hidden>> wrote:

> ** Description changed:
>
> Currently `tree -dh`/`tree -h` simply shows the size of the directory
> nodes that tend to be 4K in a default ext4 installation with 4K block
> sizes. While this is not very useful in terms of UX, it does however
> have it's use by not spending a whole lot of IO on calculating recursive
> sizes. However, in addition to the current mode, it would be great to
> have an option, that recursively adds up the size of the its contents
> and displays the total size of the directory (inclusive of all hidden
> and dot files), instead of just the directory node size.
>
> UPDATE: There's the "--du" option, that the upstream author was gracious
> enough to point out to me. This is great and solves the problem in
> theory.
>

OK, I opened up two terminal windows and was in my home directory in both
of them.

In one window I typed in
tree --du
And this gave a lot of output and a final figure.

In the other window I typed in
du -s
And this output the final figure with a dot at the end of the line.

Is this of use to you?

BW,

Ian

--
-- ACCU - Professionalism in programming - http://www.accu.org
-- My writing - https://sites.google.com/site/ianbruntlett/
-- Free Software page -
https://sites.google.com/site/ianbruntlett/home/free-software

Revision history for this message
Prasanna Loganathar (pvl) wrote :

Hi Ian,

Thank you for the reply. I appreciate it :) .. However I think you may have replied to an older version of the bug description. I did miss the "--du" option initially, but then had updated the description accordingly.

information type: Public → Public Security
information type: Public Security → Private Security
information type: Private Security → Public
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.