5 ms·
pv is just cat with a progress bar, so it only handles the case where you are copying a single big file.
by zurn 12y ago
pv is just cat with a progress bar, so it only handles the case where you are copying a single big file.
- ithkuil 12y agoIndeed. You can use it to show the progress of a recursive directory copy with this trick: tar c -C /tmp/source . | pv | tar x -C /tmp/dest you can also pass an approximated size of your source to pv, however the tar output will be slightly bigger.
- ysangkok 12y agohow would you estimate the size quickly? 'du' can take quite long
- teraflop 12y agoYou can start pv without an estimated size, run du in the background, and then supply the estimate to pv once it's calculated using the '-R' (remote control) option. A bit clumsy, but it shouldn't be hard to write a little script to do it.
- ithkuil 12y agoCool, didn't know about that pv had a remote control. Anyway, if cp -R had a progress bar it would behave the same way, i.e. it would have first to recursively stat the source the same way as du does, and only then it could start reporting a completion percentage.
- deleted 12y ago[deleted]