[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suggested enhancement to du command - show last modified date.
From: |
Frederik Eaton |
Subject: |
Re: Suggested enhancement to du command - show last modified date. |
Date: |
Fri, 24 Jun 2005 08:41:56 -0700 |
User-agent: |
Mutt/1.5.9i |
This is nice. One reason I like it, which I think hasn't been
mentioned yet, is that it gives a standard interface to a piece of
information that might be used by make systems and other programs
which need to find out when directory trees have been modified.
Working through a standard interface means that if kernel support is
ever added for computing this information more quickly (and possibly
directory sizes too), e.g. by keeping it around in each directory
inode, then userspace recognition of that support only needs to be
added in one place, namely the 'du' command. Thus consolidating the
interface to such a computation gives others more motivation to
optimize it later.
Frederik
> I use the "du" command to identify directories for potential
> archiving. Candidate directories are those that are taking a lot of
> space, and which are not currently being worked on. The "du" command
> conveniently identified the first. To find out the latter requires
> walking the directory tree, and performing a stat on each file (to
> obtain the last modified date). "du" already does most of this.
> Walking a large directory tree twice, once to collect the file sizes,
> and a second time to collect the last modified date can be time
> consuming. I therefore suggest that "du" should have an option to
> collect the latest last modified date for the files in a directory.
>
> I have hacked together a version of "du" that does this, taking the
> date formatting code from the "date" utility. If my modified program
> is run as (for example) "du --last-modified", it produces output such
> as the following:
>
> 368 2004/03/12.19:18 ./config
> 1004 2005/06/02.13:53 ./m4
> 560 2004/03/12.19:18 ./old/fileutils
> 256 2004/03/12.19:18 ./old/sh-utils
> 336 2004/03/12.19:18 ./old/textutils
> 1156 2004/03/12.19:18 ./old
> 14316 2005/06/02.13:53 ./po
> 636 2005/06/02.14:12 ./lib/.deps
> 6396 2005/06/02.14:12 ./lib
> 760 2005/06/02.14:13 ./src/.deps
> 19692 2005/06/02.18:47 ./src
> 1116 2005/06/02.13:53 ./doc
> 824 2005/06/02.13:53 ./man
> 52 2005/06/02.13:53 ./tests/basename
> 68 2005/06/02.13:53 ./tests/chgrp
>
> I chose this default date format so that the "sort" utility will
> regard it as one field, and so that alphabetical sorting is the same
> as date sorting.
>
> I can also specify the date format required, using the same syntax as
> for the "date" command. For example, using "du
> --last-modified=%e/%b/%Y" produces:
>
> 368 12/Mar/2004 ./config
> 1004 2/Jun/2005 ./m4
> 560 12/Mar/2004 ./old/fileutils
> 256 12/Mar/2004 ./old/sh-utils
> 336 12/Mar/2004 ./old/textutils
> 1156 12/Mar/2004 ./old
> 14316 2/Jun/2005 ./po
> 636 2/Jun/2005 ./lib/.deps
> 6396 2/Jun/2005 ./lib
> 760 2/Jun/2005 ./src/.deps
> 19692 2/Jun/2005 ./src
> 1116 2/Jun/2005 ./doc
> 824 2/Jun/2005 ./man
> 52 2/Jun/2005 ./tests/basename
> 68 2/Jun/2005 ./tests/chgrp
>
> Without the "--last-modified" switch, the modified program functions
> as previously.
>
> If you think my suggestion worthwhile, I would be happy to contribute
> my modified code back to the GNU project, but I am very much a GNU
> newbie. I don't know how to generate patch files. Also I have not made
> any attempt to update the man files or other documentation. Please let
> me know if you would like me to submit the code, and if so, how I
> should do so ?
>
> Alternately, you could probably produce a better implementation, based
> upon my description above.
>
> Yours sincerely,
>
> Bill Brendling.
>
>
> _______________________________________________
> Bug-coreutils mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-coreutils
>
--
http://ofb.net/~frederik/
- Re: Suggested enhancement to du command - show last modified date., (continued)
- Re: Suggested enhancement to du command - show last modified date., Jim Meyering, 2005/06/04
- Re: Suggested enhancement to du command - show last modified date., William Brendling, 2005/06/07
- Re: Suggested enhancement to du command - show last modified date., Jim Meyering, 2005/06/07
- Re: Suggested enhancement to du command - show last modified date., William Brendling, 2005/06/08
- Re: Suggested enhancement to du command - show last modified date., Paul Eggert, 2005/06/08
- Re: Suggested enhancement to du command - show last modified date., William Brendling, 2005/06/09
- Re: Suggested enhancement to du command - show last modified date., Paul Eggert, 2005/06/09
- Message not available
- Suggested enhancement to du command - show last modified date., William Brendling, 2005/06/23
- Re: Suggested enhancement to du command - show last modified date., Jim Meyering, 2005/06/23
- Re: Suggested enhancement to du command - show last modified date., Paul Eggert, 2005/06/23
Re: Suggested enhancement to du command - show last modified date.,
Frederik Eaton <=