How to Get rsync Overall Progress

This post shows you how to get a simple progress bar while transferring files using rsync.

I used the following commands transferring a large directory from a Mac to a Linux machine so the args might be different otherwise.

Requirements

  • find - used to get the number of files in the source directory
  • wc - counts the files found from find
  • rsync - used for the actual file transfer
  • pv - monitor data's progress through a pipe

Step 1: Get the total number of files your transferring

Use the following command to get the number of files in the source directory:

find /path/to/source/directory -type f | wc -l

For demonstration purposes, let's say the number of files is 294802.

Step 2: Transfer the files with a Progress Bar

Now use the number of files found in step 1 as the arg for pv below:

rsync -vrltD --stats --human-readable /path/to/source/directory user@host:/path/to/target/directory/ | pv -lep -s 294802 >/dev/null

You should get output similar to the following single line showing the progress of the transfer:

[=================================================>          ]  92% ETA 0:01:23