<p>I use <a href="http://rsync.samba.org/" rel="nofollow noreferrer">rsync</a> to synchronize files to Windows clients in a server agnostic way. What methods are available to send the progress of rsync to the parent process for display in a gui progress bar?</p>

<p>I imagine two or three choices exist. (1) Watch STDOUT (2) Watch rsync.exe log file, similar to unix <code>tail</code> (3) Watch rsync console output in memory.</p>

<p>Which one is best/preferred?</p>

[{'answer_id': 8007, 'author': 'Lars Mæhlum', 'author_id': 960, 'author_profile': 'https://Stackoverflow.com/users/960', 'pm_score': 1, 'selected': False, 'text': '<p>.NET has a pretty straight forward way to read and watch STDOUT. <br />\nI guess this would be the cleanest way, since it is not dependent on any external files, just the path to rsync. I would not be too surprised if there is a wrapper library out there either. If not, write and open source it :)</p>\n'}, {'answer_id': 8011, 'author': 'Adam Lerman', 'author_id': 673, 'author_profile': 'https://Stackoverflow.com/users/673', 'pm_score': 0, 'selected': False, 'text': '<p>Check out <a href="http://www.download.com/DeltaCopy/3000-2242_4-10471616.html" rel="nofollow noreferrer">DeltaCopy</a>. It is a Windows GUI for rsync.</p>\n'}, {'answer_id': 8090, 'author': 'PabloG', 'author_id': 394, 'author_profile': 'https://Stackoverflow.com/users/394', 'pm_score': 3, 'selected': True, 'text': '<p>For this type of tasks, I use my own <a href="http://www.autoitscript.com/autoit3/" rel="nofollow noreferrer">AutoIt</a> script (freeware, Windows only). The script redirects the standard output into a graphical window, displaying it with the ability to scroll back, etc (very useful in long processes like XCOPYs / PKZIPs to check if any error did happen).</p>\n\n<p>I use AutoIt because it\'s free, very easy to use, and can compile quickly into an .EXE. I think it\'s an excellent alternative to a complete programming language for this type of tasks. The downside is that it\'s for Windows only.</p>\n\n<pre><code>$sCmd = "DIR E:\\*.AU3 /S"  ; Test command\n$nAutoTimeout = 10      ; Time in seconds to close window after finish\n\n$nDeskPct = 60          ; % of desktop size (if percent)\n\n; $nHeight = 480          ; height/width of the main window (if fixed)\n; $nWidth = 480\n\n$sTitRun = "Executing process. Wait...."     ; \n$sTitDone = "Process done"                ; \n\n$sSound = @WindowsDir &amp; "\\Media\\Ding.wav"       ; End Sound\n\n$sButRun = "Cancel"                           ; Caption of "Exec" button\n$sButDone = "Close"                            ; Caption of "Close" button\n\n#include &lt;GUIConstants.au3&gt;\n#include &lt;Constants.au3&gt;\n#Include &lt;GuiList.au3&gt;\n\nOpt("GUIOnEventMode", 1)\n\nif $nDeskPct &gt; 0 Then\n    $nHeight = @DesktopHeight * ($nDeskPct / 100)\n    $nWidth = @DesktopWidth * ($nDeskPct / 100)\nEndIf\n\n\nIf $CmdLine[0] &gt; 0 Then\n    $sCmd = ""\n    For $nCmd = 1 To $CmdLine[0]\n        $sCmd = $sCmd &amp; " " &amp; $CmdLine[$nCmd]\n    Next\n\n    ; MsgBox (1,"",$sCmd)\nEndIf\n\n; AutoItSetOption("GUIDataSeparatorChar", Chr(13)+Chr(10))\n\n$nForm = GUICreate($sTitRun, $nWidth, $nHeight)\nGUISetOnEvent($GUI_EVENT_CLOSE, "CloseForm")\n\n$nList = GUICtrlCreateList ("", 10, 10, $nWidth - 20, $nHeight - 50, $WS_BORDER + $WS_VSCROLL)\nGUICtrlSetFont (-1, 9, 0, 0, "Courier New")\n\n$nClose = GUICtrlCreateButton ($sButRun, $nWidth - 100, $nHeight - 40, 80, 30)\nGUICtrlSetOnEvent (-1, "CloseForm")\n\nGUISetState(@SW_SHOW)   ;, $nForm)\n\n$nPID = Run(@ComSpec &amp; " /C " &amp; $sCmd, ".", @SW_HIDE, $STDOUT_CHILD)\n; $nPID = Run(@ComSpec &amp; " /C _RunErrl.bat " &amp; $sCmd, ".", @SW_HIDE, $STDOUT_CHILD)     ; # Con ésto devuelve el errorlevel en _ERRL.TMP\n\nWhile 1\n    $sLine = StdoutRead($nPID)\n    If @error Then ExitLoop\n\n    If StringLen ($sLine) &gt; 0 then\n        $sLine = StringReplace ($sLine, Chr(13), "|")\n        $sLine = StringReplace ($sLine, Chr(10), "")\n        if StringLeft($sLine, 1)="|" Then\n            $sLine = " " &amp; $sLine\n        endif\n\n        GUICtrlSetData ($nList, $sLine)\n\n        _GUICtrlListSelectIndex ($nList, _GUICtrlListCount ($nList) - 1)\n    EndIf\nWend\n\n$sLine = " ||"\nGUICtrlSetData ($nList, $sLine)\n_GUICtrlListSelectIndex ($nList, _GUICtrlListCount ($nList) - 1)\n\nGUICtrlSetData ($nClose, $sButDone)\n\nWinSetTitle ($sTitRun, "", $sTitDone)\nIf $sSound &lt;&gt; "" Then\n    SoundPlay ($sSound)\nEndIf\n\n$rInfo = DllStructCreate("uint;dword")      ; # LASTINPUTINFO\nDllStructSetData($rInfo, 1, DllStructGetSize($rInfo));\n\nDllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($rInfo))\n$nLastInput = DllStructGetData($rInfo, 2)\n\n$nTime = TimerInit()\n\nWhile 1\n    If $nAutoTimeout &gt; 0 Then\n        DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($rInfo))\n        If DllStructGetData($rInfo, 2) &lt;&gt; $nLastInput Then\n            ; Tocó una tecla\n            $nAutoTimeout = 0\n        EndIf\n    EndIf\n\n    If $nAutoTimeout &gt; 0 And TimerDiff ($nTime) &gt; $nAutoTimeOut * 1000 Then\n        ExitLoop\n    EndIf\n\n    Sleep (100)\nWend\n\n\nFunc CloseForm()\n    Exit\nEndFunc\n</code></pre>\n'}, {'answer_id': 35294, 'author': 'Scott Kramer', 'author_id': 3522, 'author_profile': 'https://Stackoverflow.com/users/3522', 'pm_score': 1, 'selected': False, 'text': '<p>I\'ve built my own simple object for this, I get a lot of reuse out of it, I can wrap it with a <code>cmdline</code>, <code>web page</code>, <code>webservice</code>, write output to a file, etc---</p>\n\n<p>The commented items contain some <code>rsync</code> examples--</p>\n\n<p>what I\'d like to do sometime is embed <code>rsync</code> (and <code>cygwin</code>) into a resource &amp; make a single .net executable out of it--</p>\n\n<p>Here you go:</p>\n\n<pre><code>Imports System.IO\n\nNamespace cds\n\nPublic Class proc\n\n    Public _cmdString As String\n    Public _workingDir As String\n    Public _arg As String\n\n\n    Public Function basic() As String\n\n        Dim sOut As String = ""\n\n        Try\n            \'Set start information.\n            \'Dim startinfo As New ProcessStartInfo("C:\\Program Files\\cwRsync\\bin\\rsync", "-avzrbP 192.168.42.6::cdsERP /cygdrive/s/cdsERP_rsync/gwy")\n            \'Dim startinfo As New ProcessStartInfo("C:\\Program Files\\cwRsync\\bin\\rsync", "-avzrbP 10.1.1.6::user /cygdrive/s/cdsERP_rsync/gws/user")\n            \'Dim startinfo As New ProcessStartInfo("C:\\windows\\system32\\cscript", "//NoLogo c:\\windows\\system32\\prnmngr.vbs -l")\n\n            Dim si As New ProcessStartInfo(_cmdString, _arg)\n\n            si.UseShellExecute = False\n            si.CreateNoWindow = True\n            si.RedirectStandardOutput = True\n            si.RedirectStandardError = True\n\n            si.WorkingDirectory = _workingDir\n\n\n            \' Make the process and set its start information.\n            Dim p As New Process()\n            p.StartInfo = si\n\n            \' Start the process.\n            p.Start()\n\n            \' Attach to stdout and stderr.\n            Dim stdout As StreamReader = p.StandardOutput()\n            Dim stderr As StreamReader = p.StandardError()\n\n            sOut = stdout.ReadToEnd() &amp; ControlChars.NewLine &amp; stderr.ReadToEnd()\n\n            \'Dim writer As New StreamWriter("out.txt", FileMode.CreateNew)\n            \'writer.Write(sOut)\n            \'writer.Close()\n\n            stdout.Close()\n            stderr.Close()\n            p.Close()\n\n\n        Catch ex As Exception\n\n            sOut = ex.Message\n\n        End Try\n\n        Return sOut\n\n    End Function\n\nEnd Class\nEnd Namespace\n</code></pre>\n'}, {'answer_id': 1056630, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>Check <a href="http://www.nasbackup.com" rel="nofollow noreferrer">NAsBackup</a>  Its open source software that give Windows user Rsync GUI using Watch STDOUT.</p>\n'}]
['https://Stackoverflow.com/questions/8004', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1027/']