john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Cp with percent progress

linux-cp-with-percent-progress-sh

!/bin/sh

cp_p() { strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \ | awk '{ count += $NF if (count % 10 == 0) { percent = count / total_size * 100 printf "%3d%% [", percent for (i=0;i<=percent;i++) printf "=" printf ">" for (i=percent;i<100;i++) printf " " printf "]\r" } } END { print "" }' total_size=$(stat -c '%s' "${1}") count=0 }


  • « Htpasswd remote add user.sh
  • Wrx.sh »

Published

Feb 6, 2010

Category

linux

~41 words

Tags

  • cp 1
  • percent 1
  • progress 1
  • scripts 63
  • with 29