bugGNU Core Utilities - Bugs: bug #13956, du --max-depth uses arbitrary order

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #13956: du --max-depth uses arbitrary order

Submitted by:  None
Submitted on:  Wed 27 Jul 2005 07:17:04 PM UTC  
Votes:  10  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Sun 08 Oct 2006 08:40:57 PM UTC, comment #2:

du (from coreutils-6.3) already works like you request:

> or if you could optionally enable single-counting of multiply > linked files when using multiple command line arguments.


$ mkdir 1 2
$ dd if=/dev/zero of=1/k count=10000 2>/dev/null
$ ln 1/k 2/k
$ du -sh 1 2
4.9M 1

  1. 2

So I'm closing this.

Jim Meyering <meyering>
Project Administrator
Sun 12 Feb 2006 07:55:20 AM UTC, comment #1:

I found this through a web search, because I need the exact same feature for the exact same reason.

Daniel Webb <danielwebb>
Wed 27 Jul 2005 07:17:04 PM UTC, original submission:

I employ a hard-link based backup system similar to that described here:

http://www.mikerubel.org/computers/rsync_snapshots/

It saves only changed files in a set of time-stamped directories. To compute the differential storage usage of a collection of backup directories, it is useful to use:

% du -h --max-depth=1

However, this is made less useful by the fact that du apparently doesn't preserve the lexical ordering of the directories in the shell.

E.g., with this set:

b2005-03-05__04:08:17/
b2005-04-02__04:04:34/
b2005-05-07__04:04:47/
b2005-06-04__04:08:37/
b2005-07-02__04:08:05/
b2005-07-16__04:04:21/
b2005-07-21__04:04:21/
b2005-07-22__04:07:52/
b2005-07-23__04:04:30/
b2005-07-24__04:05:00/
b2005-07-25__04:03:45/
b2005-07-26__04:05:36/
b2005-07-27__04:09:00/

I get:

% du -h --max-depth=1

38G ./b2005-07-02__04:08:05
296M ./b2005-06-04__04:08:37
4.6G ./b2005-07-23__04:04:30
273M ./b2005-07-16__04:04:21
2.5G ./b2005-07-27__04:09:00
3.5G ./b2005-03-05__04:08:17
318M ./b2005-04-02__04:04:34
2.4G ./b2005-07-21__04:04:21
....

I.e., in a random order (not even sorted by the directories' inodes). I cannot use shell expansion to force the order I want:

% du -sh b*

because then du does not keep track of multiply-linked files, and counts them multiple times.

It would be very useful if du traversed directories in lexical order, or if you could optionally enable single-counting of multiply linked files when using multiple command line arguments.

JD Smith

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 10 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sun 08 Oct 2006 08:40:57 PM UTCmeyeringStatusNone=>Fixed
  Open/ClosedOpen=>Closed
Sun 12 Feb 2006 07:51:38 AM UTCdanielwebbCarbon-Copy-=>Added danielwebb

Back to the top


Powered by Savane 3.1-cleanup1