I know I can get disk usage of the files/directories in a directory like this:
for file in $(ls); do du --hum --sum $file; done
That seems to break down if the files/directories have spaces in their names. So I tried this:
find . -maxdepth 1 -type d -print0 | xargs -0 du --hum --sum
That yields only this:
2.3G .
Whereas there are 8 subdirectories in my directory.
du -h -s ./*
? Anyway, thatfind
fails because it includes.
in the output, anddu
is smart enough to notice all the other directories are under it. – ilkkachu Apr 06 '21 at 23:22