-
-
Save kasramp/db463b0c1741086e52dc9650d620b3fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# SCRIPT: copyx ver 1.0, 14-9-2011 | |
# PURPOSE: Copies files and shows the progress of copying. | |
# Usage Example: ./copyx my100gbfiles.tar.gz /path/to/destination/my100gbfiles.tar.gz | |
strace -q -ewrite cp -- "${1}" "${2}" 2>&1 | | |
awk '{ | |
cal += $NF | |
if (cal % 10 == 0) { | |
percentage = cal / totalsize * 100 | |
printf "%3d%% [", percentage | |
for (i=0;i<=percentage;i++) | |
printf "=" | |
printf ">" | |
for (i=percentage;i<100;i++) | |
printf " " | |
printf "]\r" | |
} | |
} | |
END { print "" }' totalsize=$(stat -c '%s' "${1}") cal=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment