Possible Duplicate:
How to show the rsync –progress in web browser using DJango?
I have this linux command:
rsync -avz --info=progress2 source:/file /destination
which I have used in Python like this:
proc = subprocess.Popen(['sshpass', '-p', password, 'rsync', '-avz', '--info=progress2', source12, destination],
stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]
This store the output as well as progress in proc variable like this:
receiving incremental file list
rathi/
rathi/20090209.02s1.1_sequence.txt.gz
209,398,969 27% 11.95MB/s 0:00:45
I only want to extract the progress percentage from the above line. I want to check the variable for each 1minute and extracts the updated percentage. For the parsing I think can use re module. How can I achieve my result? Thanks
You can get the progress with re indeed.
Where str is your string to search in.
Edit:
You need to make a while loop e.g.