[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: du enhancement request
From: |
Rafal Maszkowski |
Subject: |
Re: du enhancement request |
Date: |
Thu, 9 Oct 2008 10:05:31 +0200 |
User-agent: |
Mutt/1.5.9i |
On Wed, Oct 08, 2008 at 08:20:09PM -0600, Eric Blake wrote:
> According to Rafal Maszkowski on 10/8/2008 3:16 PM:
> > It happens to me that I need to count files in directories. du is a
> > command which woud fit best to such task if it had an option "count
> > number of files instead of number of bytes". It could be -i as in df -i.
> Better than adding an extension that won't be widely available, how about
> using an existing command? For example:
> find . | wc -l
> is a close approximation and available on any POSIX system (it mishandles
> files with embedded newlines in the name). If you use GNU findutils, you
> can use the more accurate:
> find -printf - | wc -c
Sure, I do use commands like ls|wc -l but sometimes I would like to look
into several directories at once, e.g.:
address@hidden:/pub/Linux/aurora/development,1> du -sch *
13G source
17G sparc
12G sparc64
42G total
address@hidden:/pub/Linux/aurora/development,1> du -sic *
6024 source
12982 sparc
12501 sparc64
31507 total
address@hidden:/pub/Linux/aurora/development,0> du -ic *
8 source/SRPMS/repodata
6023 source/SRPMS
6024 source
10 sparc/os/repodata
9558 sparc/os/Packages
9569 sparc/os
8 sparc/debug/repodata
3412 sparc/debug
12982 sparc
10 sparc64/os/repodata
9126 sparc64/os/Packages
9137 sparc64/os
8 sparc64/debug/repodata
3363 sparc64/debug
12501 sparc64
81739 total
It could be a separate command but I like the du options like -s, -c and
-h which would be usefull with this file-counting -i too.
R.
--
Jeżeli upadnie cywilizacja zachodnia, to będzie szansa na odbudowę cywilizacji
chrześcijańskiej. (dr Stanisław Krajski, Radio Maryja, 10 X 2001)