Sujet : Re: Folder size and number of files
De : fritz (at) *nospam* spamexpire-202409.rodent.frell.theremailer.net (Fritz Wuehler)
Groupes : comp.os.linux.miscDate : 25. Sep 2024, 22:44:01
Autres entêtes
Organisation : dizum.com - The Internet Problem Provider
Message-ID : <68c9c54a3b889d0a44fea274585806ac@msgid.frell.theremailer.net>
References : 1
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