Du –exclude directories – is this possible

backupdisk-usagersync

How to calculate disk usage of a file tree but excluding directories.

I'd like to have something like:

du --exclude type d

I use rsync to mirror/backup part of my home dir and I want to double check total size after backup but for some reason one directory got different size on source and target namely: 12288 B and 16384 B. While obviously most of directories got 4096 B.

Both source and target are ext4.

Best Answer

Simply feed it a list of everything you DO want counted using --files0-from

 find -type f -print0 | du --files0-from=-
Related Question