On Thu, 6 Oct 2011, Paul Dugas wrote:

I appreciate the suggestions so far but I know how to measure usage with 'du' et al. The hitch here is that I want to exclude files the --filter='dir-merge .rsync-filter' excludes. Hense the thought to use rsync itself.

It sounds like you missed the point of Kevin's message (in the other fork of this thread). The point wasn't to use `du`, it was that you can run your stats against the backed-up files, not the source. Then you're only running stats against the results of running the backup using the filters, so you don't need to filter them again.

If that doesn't make sense or isn't possible (backups are on some remote server), then just use your rsync command with '--list-only', and post-process that list.

E.g., if your command is:

rsync -a --filter='dir-merge .rsync-filter' /source /dest

It becomes, with a post-processing command that just counts bytes from files (not dirs/sockets/etc.): (all one command line -- munged for emailing)

rsync --list-only -a --filter='dir-merge .rsync-filter' /source /dest
| awk '/^-/ { total += $2 } END { print total }'

Post-processing is made simpler by the fact that rsync escapes "special" characters already. (So, you don't have to worry about null bytes or newlines or anything in the filenames.)

--
Best,
Ben
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to