I'm performing an rsync process to copy files from an SD card and I want to show the progress per file in Zenity during the rsync process per file. I tried Zenity and rsync which seemed perfect for me. It should send the current file and % copied to Zenity, but I cannot get it to, output is not realtime and does not move the progress bar. And I could not figure out why its not working.
What I'm trying to do at the least is send the percentage of the file copy into Zenity to drive the progress bar. But this needs to be a number without the trailing % to drive the progress bar.
This does not output anything, but if I remove the sed and Zenity steps then I get: 0%, 1%, 2% etc. But Zenity requires non percentage values.
sudo rsync -av --info=progress2 "$f"/*.MP4 $copydest | \
strace -e trace=read grep "[0-9]*%" 2>&1 > /dev/null | grep -o "[[:digit:]]*%" | sed 's/[^0-9]//g' | \
zenity --width=400 --height=20 --progress --percentage=0 --text="Copying...." --auto-close --auto-kill \
--title="Copying $tc from $cardname"
Ideally, I would like the current filename to display as well, but I'm stuck. For example,
Filename.MP4
.......... (progress)
There must be a recipe in grep or sed or awk that I can grab the MP4 file name and the % of copied as a number, but its beyond me.
Here's what rsync will output on 3 files with incrementing % and time remaining etc
25_nn67_P1680210.MP4
1,024,202,031 100% 163.00MB/s 0:00:05 (xfr#1, to-chk=2/3)
25_nn67_P1680211.MP4
146,801,421 100% 49.12MB/s 0:00:02 (xfr#2, to-chk=1/3)
25_nn67_P1680212.MP4