rsync du (was rsync delete)
Matt McCutchen
matt at mattmccutchen.net
Sun Dec 23 04:03:39 GMT 2007
On Sat, 2007-12-22 at 18:47 -0800, Jesse Thompson wrote:
> Now I'm interested in a new possibility however. Using rsync
> (connecting to a remote rsync server via rsync protocol) is there a
> way to measure the size of a directory, kind of like du, without
> having to transfer it?
Yes. Do a transfer of the directory in dry-run mode (so no data is
actually copied) and pass --stats. Look at the "Total file size"
statistic, which is the total size of all regular file data and symlink
target paths:
$ rsync -na --stats remote::volume/directory/ /nonexistent/
Number of files: 30
Number of files transferred: 12
==> Total file size: 9148 bytes
Total transferred file size: 9124 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 625
File list generation time: 0.003 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 737
Total bytes received: 111
sent 737 bytes received 111 bytes 1696.00 bytes/sec
total size is 9148 speedup is 10.79 (DRY RUN)
If you like, you can account for inodes and directories (very
approximately) by adding some multiple of the "File list size".
Matt
More information about the rsync
mailing list