Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

You will not be elected to public office this year.


comp / comp.os.linux.misc / Re: Folder size and number of files

SubjectAuthor
* Re: Folder size and number of filesFritz Wuehler
`- Re: Folder size and number of filesLawrence D'Oliveiro

1
Subject: Re: Folder size and number of files
From: Fritz Wuehler
Newsgroups: comp.os.linux.misc
Organization: dizum.com - The Internet Problem Provider
Date: Wed, 25 Sep 2024 20:44 UTC
References: 1
From: fritz@spamexpire-202409.rodent.frell.theremailer.net (Fritz Wuehler)
Subject: Re: Folder size and number of files
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
References: <vd0gprk64u@dont-email.me>
Message-ID: <68c9c54a3b889d0a44fea274585806ac@msgid.frell.theremailer.net>
Date: Wed, 25 Sep 2024 22:44:01 +0200
Newsgroups: comp.os.linux.misc
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.swapon.de!news.in-chemnitz.de!news2.arglkargh.de!alphared!sewer!news.dizum.net!not-for-mail
Organization: dizum.com - The Internet Problem Provider
X-Abuse: abuse@dizum.com
Injection-Info: sewer.dizum.com - 2001::1/128
View all headers

db <dieterhansbr...@gmail.com> [d]:
d> Is there a command that gives me the size of a given folder, and
d> the number of files in it?

No, but you can always define your own:

dir_size_and_number_of_files(){
# collect the output of du/find
set $(
du -sh "${1:-.}"; find "${1:-.}" -type f | wc -l
)
# and print it nicely
echo -e "$2\t$1\t$3"
}

And then use it with or without a directory argument:

dir_size_and_number_of_files /home/user123
/home/user123 2.7M 263

# when run with no arguments, it will check the current directory
dir_size_and_number_of_files
.. 324k 19

Subject: Re: Folder size and number of files
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Wed, 25 Sep 2024 21:34 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Folder size and number of files
Date: Wed, 25 Sep 2024 21:34:21 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <vd1vkt$3r2r4$8@dont-email.me>
References: <vd0gprk64u@dont-email.me>
<68c9c54a3b889d0a44fea274585806ac@msgid.frell.theremailer.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 25 Sep 2024 23:34:22 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="d676190ddbdcb7173a64dc657b0df900";
logging-data="4033380"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/C23m0ozoEsw1tdSVNCkOd"
User-Agent: Pan/0.160 (Toresk; )
Cancel-Lock: sha1:1g8yIodlCMGlDLOm4HxIPSsy4ic=
View all headers

On Wed, 25 Sep 2024 22:44:01 +0200, Fritz Wuehler wrote:

> ... find "${1:-.}" -type f | wc -l ...

This counts the total number of files in all descendant subdirectories as
well. Might or might not be what you want.

1

rocksolid light 0.9.8
clearnet tor