function for copy files with progress bar (using pv – pipe viewer)

function for copy files with progress bar (using pv – pipe viewer)

1
 cp_p() { if [ `echo "$2" | grep ".*/$"` ]; then pv "$1" > "$2""$1"; else pv "$1" > "$2"/"$1"; fi; }

dont have to type new file name (it copy file under same name) and dont have to use ‘/’ in the end of destination folder (but you can if u want, its idiot proof)

* View this command to comment, vote or add to favourites * View all commands by chmurli

commandlinefu.com

by David Winterbottom (codeinthehole.com)

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/f3Uy8ZDqE8Q/function-for-copy-files-with-progress-bar-using-pv-pipe-viewer

Enhanced by Zemanta

About Amit Agarwal