Count of files to be transferred

Ryan Joseph thealchemistguild at
Fri Apr 30 01:21:46 MDT 2010

On Apr 30, 2010, at 12:54 PM, Matt McCutchen wrote:

> On Fri, 2010-04-30 at 12:13 +0700, Ryan Joseph wrote:
>> I'm making a GUI for rsync and having some problems getting a reliable
>> indication of the files that will be transferred (so I can make a
>> progress bar from the results). I didn't see rysnc offered this so my
>> plan has been to get a list of files that will be transferred and
>> count them as rsync reports them using the -v option thus getting a
>> ratio I could make a progress bar from.
>> The problem is I don't see there is a way to have rsync tell me which
>> files will be transferred so I can count the list.
> Rsync determines which of the files in the file list need a data
> transfer as it goes, so the only way to get the count in advance is to
> do a separate dry run.  Then you could take the "Number of files
> transferred" from --stats output.

What do you mean "dry run" and wouldn't that take as much time as the real backup thus effectively doubling the time? If so that's probably not a good option.

> Alternatively, you could base the progress bar on the total number of
> entries in the file list.  The --progress option does this, but it won't
> be accurate if incremental recursion is enabled.

I tried the --progress option but it only seemed to show the progress for each file which really isn't helpful for my case. 

How do I get the file list then? If I could read a list of files that will be transferred (rsync says it builds this list so it must be somewhere) then I could deduct the files it prints (using -v) and get an accurate count.

Thanks for your suggestions.


More information about the rsync mailing list