Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # $1 is gid.
- # $2 is the number of files.
- # $3 is the path of the first file.
- DOWNLOAD=/home/jsteward/aria2
- #COMPLETE=/home/jsteward/gcscache
- LOG=/home/jsteward/aria2/mvcompleted.log
- SRC=$3
- if [ "$2" == "0" ]; then
- echo `date` "INFO no file to move for" "$1". >> "$LOG"
- exit 0
- fi
- while true; do
- DIR=`dirname "$SRC"`
- if [ "$DIR" == "$DOWNLOAD" ]; then
- # mv --backup=t "$SRC" "$COMPLETE" >> "$LOG" 2>&1
- rclone copyto "$SRC" "gdrive:archive/Uncategorized/${SRC##*/}" >> "$LOG" 2>&1 || exit 1
- echo `date` "INFO " "$3" moved as gdrive:archive/Uncategorized/${SRC##*/}. >> "$LOG"
- # [[ -d "$SRC" ]] && rmdir "$SRC" >> "$LOG" 2>&1
- rm -rf "$SRC" >> "$LOG" 2>&1
- exit 0
- elif [ "$DIR" == "/" -o "$DIR" == "." ]; then
- echo `date` "ERROR " "$3" not under "$DOWNLOAD". >> "$LOG"
- exit 1
- else
- SRC=$DIR
- fi
- done
Add Comment
Please, Sign In to add comment