Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

AppleScriptObjC | Progress bar and rsync

Hi


I'm trying to add on my app a progress bar that increases depending on the progress of rsync synchronization.

Is there a way to do that without ASObjC Runner and other stuff lime this, but do the whole thing in x-code?

I also know that in rsync the flag --progress shows the percentage progress of the synchronization, maybe it can be done reading the value of the progress.

I hope someone can answer.


Thanks in advance!

Posted on Jul 17, 2014 1:34 AM

Reply
1 reply

Jul 17, 2014 7:05 AM in response to Matteo_999

Progress bar's aren't intelligent things that somehow keep track of the progress of an operation on their own. You as the programmer need to know where you are in the operation and undate the progress bar to reflect this. So this means you need to know just how much of the operation has taken place at any given point in time.


If you start up an rsync process from your application there is no way to know how much progress has taken place, just as if you started up rsync from the terminal. Rsync does it's thing and you want for the terminal prompt to come back to know it is done.


So in this case there is no way to meaningfully update a progress bar.


However there is that --progress argument to rsync that does print out something on the terminal which sort of informs the user as to what is going on. If you read the explanation of the progress argument you'll see that rsync might not know just how much progress it has made, it's a bit of a guess for it also.


Now if you really wanted to you could capture rsync's output in your program parse the line it is printing and use that information to update a progress bar but to be honest this is a lot more work then, for me at least, it is worth.


Operations like this are usually best indicted by using the indeterminate progress indicator,


User uploaded file

You let the user know something is going on but you don;t rally know how long the operation will take.


regards

AppleScriptObjC | Progress bar and rsync

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.