Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <vd149s$3mkj5$2@dont-email.me>
Deutsch   English   Français   Italiano  
<vd149s$3mkj5$2@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feeds.phibee-telecom.net!3.eu.feeder.erje.net!feeder.erje.net!news.in-chemnitz.de!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Rich <rich@example.invalid>
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=
Bytes: 2289

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.