This question already has an answer here:
I have a directory with the following subdirectories, i.e. If I run
$ tree -L 1
. ├── 2007-06-20_to_2008-10-01 ├── 2008-07-21_to_2008_08_12-Nokia 2mp ├── 2009-11-01_to_2011-01-10 - All iphone Pics ├── 2011-01-01 palliser-pics ├── 2011-03-10_to_2011-04-12-few iphone pics b4 switch to HTC └── 2011-03-31-to-2013-05-01 ALL HTC pics-backup-prior-to-factory-reset
I would like to see the amount of diskspace those 2 directories and all their contents take up.
e.g. desired output, something like
2.7G 2007-06-20_to_2008-10-01 200MB 2008-07-21_to_2008_08_12-Nokia 2mp 1.3G 2009-11-01_to_2011-01-10 - All iphone Pics 667MB 2011-01-01 palliser-pics 2.3G 2011-03-10_to_2011-04-12-few iphone pics b4 switch to HTC 123MB 2011-03-31-to-2013-05-01 ALL HTC pics-backup-prior-to-factory-reset
So I have been trying:
find . -maxdepth 1 -type d | xargs du -h
but because some of the directory names contain spaces each line from the
find output is producing many
WORD's before being passed to
xargs, is it possible to fix this?
I know the root cause of the problem is caused by the spaces in the files, and I will use
rename to fix if I cant find a way to get disksize with