Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

You have an unusual understanding of the problems of human relationships.


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

SubjectAuthor
* Folder size and number of filesdb
+- Re: Folder size and number of filesG
+- Re: Folder size and number of filesRich
`* Re: Folder size and number of filesLawrence D'Oliveiro
 +- Re: Folder size and number of filesMike Scott
 `- Re: Folder size and number of filesG

1
Subject: Folder size and number of files
From: db
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Wed, 25 Sep 2024 08:14 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dieterhansbritz@gmail.com (db)
Newsgroups: comp.os.linux.misc
Subject: Folder size and number of files
Date: Wed, 25 Sep 2024 08:14:51 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <vd0gpr$3k64u$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 25 Sep 2024 10:14:52 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="acca16760098f35be33b6039018506ea";
logging-data="3807390"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18FK+uILa5L1xV4GIE3DYJY/UmJvhdEg7E="
User-Agent: Pan/0.149 (Bellevue; 4c157ba)
Cancel-Lock: sha1:9hPmT6n6SkGlZABQrWX/7wzTTcY=
View all headers

I like typing in commands at the console. Is there
a command that gives me the size of a given folder,
and the number of files in it? I can do that with
the GUI, right klick on the folder and Proprties,
but would prefer to do it from a typed in command.

Is there one?

--
db

Subject: Re: Folder size and number of files
From: G
Newsgroups: comp.os.linux.misc
Organization: <Not Here, Not Me>
Date: Wed, 25 Sep 2024 09:26 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: g@nowhere.invalid (G)
Newsgroups: comp.os.linux.misc
Subject: Re: Folder size and number of files
Date: 25 Sep 2024 09:26:42 GMT
Organization: <Not Here, Not Me>
Lines: 16
Sender: Gip <gip@G15.fritz.box>
Message-ID: <lli3aiFasuhU1@mid.individual.net>
References: <vd0gpr$3k64u$1@dont-email.me>
X-Trace: individual.net kMelUD9uzr/+qdA9vMDhIgSROH49JvG3QKT3UpYxN7cEwRCT+b
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:SoKORQx8/2KsEe00Mqms/3AQF3Q= sha256:sOzwhbgi5WeV8yFrmtNnCp0ylj/tdSvjlYzt/fbEfn8=
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.10.9-100.fc39.x86_64 (x86_64))
View all headers

db <dieterhansbritz@gmail.com> wrote:
> I like typing in commands at the console. Is there
> a command that gives me the size of a given folder,
> and the number of files in it? I can do that with
> the GUI, right klick on the folder and Proprties,
> but would prefer to do it from a typed in command.
>
> Is there one?
>

You can use "du" with some options for the size of folders, but the best prog
is "ncdu" (probably you'll have to install it). It gives a list of dir with
sizes and, with options "c", number of files and you can "walk" the tree with
arrows.

G

Subject: Re: Folder size and number of files
From: Rich
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Wed, 25 Sep 2024 13:47 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.os.linux.misc
Subject: Re: Folder size and number of files
Date: Wed, 25 Sep 2024 13:47:40 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <vd149s$3mkj5$2@dont-email.me>
References: <vd0gpr$3k64u$1@dont-email.me>
Injection-Date: Wed, 25 Sep 2024 15:47:40 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="c9bb3a4d1fe083989d2cd97db187f1d3";
logging-data="3887717"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+KPdJie2Wm1RpMGS553pSJ"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Cancel-Lock: sha1:4CLt6Lq6TIxxkhxHTg10aAC/+1o=
View all headers

db <dieterhansbritz@gmail.com> wrote:
> I like typing in commands at the console. Is there
> a command that gives me the size of a given folder,
> and the number of files in it? I can do that with
> the GUI, right klick on the folder and Proprties,
> but would prefer to do it from a typed in command.
>
> Is there one?

A single rollup command that does all this, no.

You construct what you need by combining the primitives together to get
what you are looking for.

For size (if by 'size' you really mean the sum of the disk space
consumed by the files inside the folder) then du with the --max-depth=
(short form -d) option to prevent it from descending into sub-folders
will give you the "disk used by all files inside".

du --max-depth=1 folder/

For count, there are several options. If all the filenames inside are
sane (as in do not themselves contain newlines) then this will give you
the count:

ls folder/ | wc -l

If your filenames contain newlines, well, you've got a lot more work
ahead....

If you really want a 'rollup' (because you use this often) you can
create either a shell function or a shell script file somewhere on your
path with a new name, i.e. size-count which does both of the above and
then you can run:

size-count folder/

to get both the disk usage and files count.

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:33 UTC
References: 1
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:33:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <vd1vjh$3r2r4$7@dont-email.me>
References: <vd0gpr$3k64u$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 25 Sep 2024 23:33:37 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="d676190ddbdcb7173a64dc657b0df900";
logging-data="4033380"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3TwTMcy2XpM6CVMum1jyQ"
User-Agent: Pan/0.160 (Toresk; )
Cancel-Lock: sha1:Z6JGJnlbDsdDez9pYNE5HHSx/+o=
View all headers

On Wed, 25 Sep 2024 08:14:51 -0000 (UTC), db wrote:

> Is there a command that gives me the size of a given folder ...

du -s «folder»

> ... and the number of files in it?

I currently use

ls «folder» | wc -l

.... not sure if there’s a more efficient way ...

Subject: Re: Folder size and number of files
From: Mike Scott
Newsgroups: comp.os.linux.misc
Organization: Scott family
Date: Thu, 26 Sep 2024 08:14 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: usenet.16@scottsonline.org.uk.invalid (Mike Scott)
Newsgroups: comp.os.linux.misc
Subject: Re: Folder size and number of files
Date: Thu, 26 Sep 2024 09:14:25 +0100
Organization: Scott family
Lines: 24
Message-ID: <vd3551$3q5k$1@dont-email.me>
References: <vd0gpr$3k64u$1@dont-email.me> <vd1vjh$3r2r4$7@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 26 Sep 2024 10:14:26 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="448a67342154bd687380ac7ae70a0c5a";
logging-data="125108"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+XbnoURaLilxmVWg997Nd39cRcRkeqcco="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:b9gxLqxHnbflHb29WVPYlZ3i1Ss=
In-Reply-To: <vd1vjh$3r2r4$7@dont-email.me>
Content-Language: en-GB
View all headers

On 25/09/2024 22:33, Lawrence D'Oliveiro wrote:
> On Wed, 25 Sep 2024 08:14:51 -0000 (UTC), db wrote:
>
>> Is there a command that gives me the size of a given folder ...
>
> du -s «folder»
>
>> ... and the number of files in it?
>
> I currently use
>
> ls «folder» | wc -l
>
> ... not sure if there’s a more efficient way ...

find ~ -ls | awk -v total=0 -v files=0 'END {print files, total} {total
= total + $7; ++files}'

maybe?

--
Mike Scott
Harlow, England

Subject: Re: Folder size and number of files
From: G
Newsgroups: comp.os.linux.misc
Organization: <Not Here, Not Me>
Date: Thu, 26 Sep 2024 08:56 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: g@nowhere.invalid (G)
Newsgroups: comp.os.linux.misc
Subject: Re: Folder size and number of files
Date: 26 Sep 2024 08:56:09 GMT
Organization: <Not Here, Not Me>
Lines: 22
Sender: Gip <gip@G15.fritz.box>
Message-ID: <llklt9Fn561U1@mid.individual.net>
References: <vd0gpr$3k64u$1@dont-email.me> <vd1vjh$3r2r4$7@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net yAAu395y41S1FWoOXFxJWAhXQMPisLpYvT+lWfJ9G6Hb1zyZ9U
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:kO5BxzaveXZqQkxiytHuNRBypYI= sha256:K5emR2/fPPujpp9C5a5XNmmJFjHEBZ0J+5DTqUMc8h4=
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.10.9-100.fc39.x86_64 (x86_64))
View all headers

Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
> On Wed, 25 Sep 2024 08:14:51 -0000 (UTC), db wrote:
>
>> Is there a command that gives me the size of a given folder ...
>
> du -s «folder»

Use "du -sh" it's more readable.

>
>> ... and the number of files in it?
>
> I currently use
>
> ls «folder» | wc -l
>
> ... not sure if there’s a more efficient way ...

Yes, install "ncdu" it does both size and number of files (with option
"--show-itemcount" or "c" when inside), and you can navigate the folder tree.

G

1

rocksolid light 0.9.8
clearnet tor