Skip to content

Instantly share code, notes, and snippets.

@devzer01
Created January 12, 2020 16:50
Show Gist options
  • Save devzer01/a87a24b1d06fd9046c33db9f0ff846a9 to your computer and use it in GitHub Desktop.
Save devzer01/a87a24b1d06fd9046c33db9f0ff846a9 to your computer and use it in GitHub Desktop.

Revisions

  1. Nayana Hettiarachchi created this gist Jan 12, 2020.
    18 changes: 18 additions & 0 deletions move.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/bin/bash

    EXTERNAL_BACKUP_DIR="/Volumes/data disk"
    LIBRARY_NAME=$1

    mv "$LIBRARY_NAME" $EXTERNAL_BACKUP_DIR/ & #send the move to background

    # monitor the destination path
    raw footage library % lastSize=`du -s "$EXTERNAL_BACKUP_DIR/$LIBRARY_NAME" | tr '\t' ' ' | cut -d' ' -f1`;
    while true
    do
    size=`du -s "$EXTERNAL_BACKUP_DIR/$LIBRARY_NAME" | tr '\t' ' ' | cut -d' ' -f1`
    copyBytes=`expr $size - $lastSize`
    TIMESTAMP=$(date "+%y-%m-%d %H:%M:%S")
    echo "$TIMESTAMP move rate $(expr $copyBytes / 1024) kb/s"
    lastSize=$size
    sleep 1
    done