1

Is it a simple way to track the completion of a large cp -r command?
To get something like:

copying 10%
...
copying 20%

Maybe using a pipe to another command?
cp -rvv orig dest | show_as_percent


update

I've checked this question, but when I try to copy folder:
rsync -P source dest
or
rsync --progress source dest
or
rsync --info=progress2 source dest

it says: skipping directory source

After checking this resource, I see the rsync command working is:
rsync -r --progress source dest, great, but the output comes as:

source/
source/a.c
          4,114 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=3/5)
source/b.c
          5,480 100%    5.23MB/s    0:00:00 (xfr#2, to-chk=2/5)
source/c.c
          4,615 100%    4.40MB/s    0:00:00 (xfr#3, to-chk=1/5)

Is there an easy way to have the overall percentage (and not per file percentage) and a more simple output which can be easily parsed using awk for example? Looking for a way of getting in console a nice integer representing a completion percentage.

Any suggestion in the shape of:
cp -rvv orig dest | show_as_percent

Michael Mrozek
  • 93,103
  • 40
  • 240
  • 233
Evhz
  • 137
  • 1
    Checkout the command pv ;-) – thecarpy Feb 10 '18 at 13:46
  • 3
    You could use rsync in the next format: rsync -P /source/ /destination/, where -P option is to show the progress of the rsync copy. – k.Cyborg Feb 10 '18 at 14:08
  • 1
    mmm... pv doesn't come as defualt installed in my unix system, solutions should not require an install, as no an easy apt-get install is possible. @k.Cyborg, thanks, rsync -P looks awesome. – Evhz Feb 19 '18 at 13:07
  • @Evhz : That comment is totally unfair. The "pv" command isn't installed by default on many systems, but one likely cause of that would be that it may just be a bit of a newer command. It's a nice command, useful with way more purposes than rsync, so chances seem pretty good that pv may someday be included in more distributions than rsync is. rsync certainly isn't in my preferred distro by default. Although rsync is awesome, its inclusion in the operating system that you happen to use (and didn't specify) doesn't make a comment pv more worthy of general ridicule than rsync (for that reason) – TOOGAM May 06 '18 at 19:38

0 Answers0