accurate progress for UI

Matt McCutchen matt at mattmccutchen.net
Tue Jan 29 19:34:17 GMT 2008


On Tue, 2008-01-29 at 14:25 -0500, Robert DuToit wrote:
> I made a Mac UI application and am running rsync 3 from "do shell  
> script" (applescript) and am trying to parse the output so I can get a  
> progress bar to give a fairly true reading of size , or # of files,  
> copied. I notice that the output reads for example,
> 
> ..... 1650 of 8345 files to copy
> 
> and then later
> 
> ....30 of  11345  files to copy
> 
> and eventually down to
> 
> ....1 of  18000  files to copy
> 
> So I get the idea that rsync 3 is reading in "batches" or at least  
> doesn't give the total # of files up front (like apple rsync or rsyncx  
> does with a true % ) so you get  what looks like an exaggerated fast  
> beginning on the progress bar which then slows to a crawl as it nears  
> the finish line.
> 
> Is there any way to get progress to give a more overall picture. I  
> tried --stats which didn't work at all and -v and of course -- 
> progress. Just wondering if I have missed something.

Well, you can disable incremental recursion and force rsync to scan all
the files up front by passing --no-i-r.  If you pass -v and --progress,
the initial scan will print " N files..." messages that you can show to
give the user an idea of the scan progress.  Once the scan is finished,
the total won't change.

With this approach, your rsync GUI will act like the Finder copy
operation that (IIRC) scans the files up front, saying something like
"Preparing to copy... N files" as it does so.

Matt



More information about the rsync mailing list