I'm using the tree command to get a list of directories:
tree -ifd --du
This, however, seems to be only displaying the size of the directory itself and not the total for its contents.
How would I modify this command to show the total space used by each directory WITH its contents?
edit: This du command seems to come close to doing what I want but has a sorting issue:
du -h ./* | sort -k 2
The above produces a list like this:
62G ./Directory
78G ./Directory 3-14-18
36G ./Directory 3-14-18/#0986
42G ./Directory 3-14-18/#0987
38G ./Directory 3-21-18
38G ./Directory 3-21-18/#1229
31G ./Directory/#7852
31G ./Directory/#7853
Note that, in the above, the first directory, the one with no date as part of its name, is at the top but it's subs are far below. I find that, if I add even a phony date to the end, something like 0-00-00, it sorts correctly:
62G ./Directory 0-00-00
31G ./Directory 0-00-00/#7852
31G ./Directory 0-00-00/#7853
78G ./Directory 3-14-18
36G ./Directory 3-14-18/#0986
42G ./Directory 3-14-18/#0987
38G ./Directory 3-21-18
38G ./Directory 3-21-18/#1229
Additional question here would be:
How do I get the sorting to work WITHOUT having to add phony dates to everyplace I find this issue?
end edit
edit2: Per the question from AndrewF below, I'll explain that I have a lot of archived media on hard drives. I can't run them all in my system at the same time so I thought it might be a good idea to have printed lists of what's on each drive.
To that end, I'm using tree to list the entire contents of each drive. I'm trying to use du to make a much shorter list of only directories as well.
As I get these drives organized, I expect to have to do a lot of manual digging and being able to view multiple lists should give me an ability to find redundancies that can be eliminated and deleted even though I can't have physical access to all of the drives at the same time. In other words, while I can't mount all of the drives, I can view all of the lists and use them to find redundancies, then mount the drive with the redundancy, and delete the extraneous directories. Having things sorted out of order is just going to make mistakes more likely.
end edit2
thanks, babag