You can make
rsync print one line per file using
-i and then use
pv -l to report progress based on line count (in effect file count).
You will need
pv (pipe viewer): http://www.ivarch.com/programs/pv.shtml
rsync -ai sourcedir/ targetdir/ | pv -l -s filecount > logfile
Use the following command to get file count:
find sourcedir | wc -l
Note: this command will show progress information based on number of files copied. This works best if there are many smallish files. If there are only a few files which are huge then you will not have much fun.
To see progress when you are updating (or comparing) an existing copy:
(more information: Compare directories but not content of files)
rsync -aii --delete sourcedir/ targetdir/ | pv -l -s filecount > logfile
-i makes rsync print one line per file even if they are equal.
-n to compare (not actually copy or delete anything).
--delete as needed.
This command will print to screen in real time the files that differ:
rsync -aii --delete sourcedir/ targetdir/ | pv -l -s filecount |
tee logfile | grep -v "^\."
The commands above work best when there are many smallish files. If you have few huge files then some of the rsync built in progress reports might be of more help. See the rsync man page for
--info=progress2. But beware: these options will not work well with
pv. Or at least I have not found out how.
Here is a crude workaround to see progress based on size:
- note the free space of target partition before copying using
- note the size of the source dir using
watch df -h and watch the size grow.
Obviosly this only works when copying and not when updating or comparing.