Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2008-10-03 18:21:30
Size: 590
Editor: redondos
Comment: page creation
Revision 4 as of 2009-01-30 01:42:52
Size: 906
Editor: rev-88-157-241-24
Comment: add rsync
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
[[Anchor(faq93)]] <<Anchor(faq93)>>
Line 3: Line 3:
You can't with `cp(1)`, but you can either:
Line 4: Line 5:
You can't with cp(1), but you can either:
 * build one yourself with tools such as [http://www.ivarch.com/programs/pv.shtml pv] or [http://clpbar.sourceforge.net/ clpbar];
 * use some other tool, e.g. [http://members.iinet.net.au/~lynx/vcp/ vcp].
 * build one yourself with tools such as [[http://www.ivarch.com/programs/pv.shtml|pv]] or [[http://clpbar.sourceforge.net/|clpbar]];
 * use some other tool, e.g. [[http://members.iinet.net.au/~lynx/vcp/|vcp]].
Line 17: Line 17:

you can also use the rsync:

{{{
rsync -avx --progress --stats "$1" "$2"
}}}

Please note that the "total" of files can change each time rsync enter a directory and finds more/less files that it expected, but at least is more info than cp. Rsync progress is good for big transfers with small files.

How can I see a progress bar when copying/moving files?

You can't with cp(1), but you can either:

  • build one yourself with tools such as pv or clpbar;

  • use some other tool, e.g. vcp.

You may want to use pv(1) since it's packaged for many systems. In that case, it's convenient if you create a function or script to wrap it.

For example:

pv "$1" > "$2/${1##*/}"

This lacks error checking and support for moving files.

you can also use the rsync:

rsync -avx --progress --stats "$1" "$2"

Please note that the "total" of files can change each time rsync enter a directory and finds more/less files that it expected, but at least is more info than cp. Rsync progress is good for big transfers with small files.

BashFAQ/093 (last edited 2016-10-22 16:49:46 by politkovskaja)