Progress at Last
Sometimes you need more than your operating system gives you.
That's when a text editor comes in handy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #!/bin/bashEXPECTED_ARGS=2E_BADARGS=65E_BADPATH=66if [ $# -ne $EXPECTED_ARGS ]then echo "Usage: `basename $0` {source} {dest}" exit $E_BADARGSfiif [[ ! -f "$1" ]]; then echo "Source file does not exist or is not a regular file." exit $E_BADPATHfiDESTSIZE=`du -b "$1" | awk '{print \$1; }'`DESTFILENAME=`basename "$1"`if [[ -d "$2" ]]; then DESTPATH="$2/$DESTFILENAME"else DESTDIR=`dirname "$2"` if [[ ! -d "$DESTDIR" ]]; then echo "Dest dir does not exist." exit $E_BADPATH fi DESTPATH="$2"ficat "$1" | pv -s $DESTSIZE -p -e -r > "$DESTPATH"exit 0 |
Copying large files to my NAS becomes so much more fun when I actually KNOW that it's doing what it should. Progress bars FTW!
UPDATE: Now it's actually working for more than one case. :)