I need to copy a very large directory (talking in terabytes here) and want to monitor the progress.

I found that pv is a nice utility, but how can I use it for copying directories recursively? (pv src > dst doesn't work because they are directories)

PS: Running on OS X Mountain Lion, pv was installed from Mac Ports

7 Answers 7


Use rsync --progress [SRC] [DST]

Do check the man rsync page because it has a lot of very useful options. -a for archive is a good start, but it depends on your exact requirements.

Copying through a pipe will unnecessarily slow down the copy process, especially if it is files based.

  • Why would copying through a pipe slow down the process? The buffering provided by pipes and the multi-tasking associated with pipes is likely to help matters I would say. (and rsync is multi-processes and uses pipes internally IIRC). What's a copy-process that is not file-based? Nov 18, 2012 at 19:03
  • Bash is convenient, but not fast. Especially when piping one command to the other.
    – jippie
    Nov 18, 2012 at 19:25
  • @StephaneChazelas: Because a pipe's buffer is only 8KB. A program like rsync might want to use a much larger internal buffer.
    – Zan Lynx
    Nov 18, 2012 at 21:31
  • 1
    Note that --progress will only show you the per-file progress of each single file, not the overall process of a potentially larger file copy process of several files / folders.
    – benomatis
    Jun 16, 2020 at 18:09

You could use tar or pax or cpio:

mkdir -p dst &&
  (cd src && tar cf - .) | pv -trb | (cd dst && tar xpf -)
  • 1
    Additionally, you may add a v to the tar command to see the file names.
    – peterph
    Jan 21, 2014 at 15:17
  • So this will zip the source folder before doing the copy, right? My folder is 5 TB in size, so I'm not sure if this is the best way to do it? I really like using pv as it shows a really good progress status, any advice please?
    – Tak
    Mar 8, 2018 at 13:12
  • @Tak, no it doesn't zip anything as there's no compression. tar cf - outputs a stream containing the files and their metadata, which is fed through a pipe to pv which feeds it untouched to the other tar while printing a progress indication, and the other tar extracts the data in that stream. All three commands run concurrently and process data as it comes, there is nothing stored on disk, there is nothing stored in memory other than the pipe buffers and the commands internal buffers which just amounts to a few kilobytes. Mar 8, 2018 at 13:31
  • @StéphaneChazelas Thanks for the comment. I've tried it and it's working, the only thing is that the progress bar doesn't show the expected percentage it keeps going from left to right. Any idea why? I used pv with this parameters -petra which usually shows the progress bar where the bar kept getting filled until it finishes. I've upvoted your answer as well.
    – Tak
    Mar 8, 2018 at 14:59
  • @Tak, pv has no way to know how much data there is to transfer. If you have an estimate of that amount, you can pass it to it with the -s option (GNU du -sb src would give you a good approximation if the files are large enough) Mar 8, 2018 at 15:06


tar -cf - /var/log/ | pv | tar -C . -x


# tar -cf - /var/log/ | pv | tar -C . -x
tar: Removing leading `/' from member names
58MB 0:00:05 [ 2.2MB/s] [                   <=> 

Here are some commands to copy directories with progress information.

If there are many small files:

cp -av sourcedir targetdir | pv -l -s filecount > logfile

This will report progress based on number of files that are copied.

You can redirect to /dev/null if you don't need logfile.

Use the following command to get filecount:

find sourcedir | wc -l

If there are few huge files:

tar c sourcedir | pv -s size | tar x -C targetdir

This will report progress based on bytes that are copied.

targetdir must exist.

Use the following command to get size:

du -sh sourcedir

If you want to use rsync:

rsync -ai sourcedir/ targetdir/ | pv -l -s filecount > logfile

Get filecount as shown above.

If you are copying on the same system then rsync -a is practically the same as cp -a . The advantages of rsync is when you are copying over the network or if you are updating (or comparing) a previous copy.

See here for more details:


I made a progress bar for rsync (in a wrapper):

rsyncy -a FROM/ TO

It looks like this:


More info on GitHub, install with pip3 install --user rsyncy


You could do a du -b /directory/ on both source and destination while a normal copy command is in progress, and compare the two. This is just as effective and doesn't slow the copy process by pushing it through a pipe.

find source-dir -print0 | xargs -0 -I % pv % > dest-dir/%
  • 3
    Please explain tour solutipon, you‘ll want OP to be able to checo it (and learn)
    – vonbrand
    Jan 27, 2014 at 1:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .