Guest User

Untitled

a guest
Jan 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # $1 is gid.
  4. # $2 is the number of files.
  5. # $3 is the path of the first file.
  6.  
  7. DOWNLOAD=/home/jsteward/aria2
  8. #COMPLETE=/home/jsteward/gcscache
  9. LOG=/home/jsteward/aria2/mvcompleted.log
  10. SRC=$3
  11.  
  12. if [ "$2" == "0" ]; then
  13. echo `date` "INFO no file to move for" "$1". >> "$LOG"
  14. exit 0
  15. fi
  16.  
  17. while true; do
  18. DIR=`dirname "$SRC"`
  19. if [ "$DIR" == "$DOWNLOAD" ]; then
  20. # mv --backup=t "$SRC" "$COMPLETE" >> "$LOG" 2>&1
  21. rclone copyto "$SRC" "gdrive:archive/Uncategorized/${SRC##*/}" >> "$LOG" 2>&1 || exit 1
  22. echo `date` "INFO " "$3" moved as gdrive:archive/Uncategorized/${SRC##*/}. >> "$LOG"
  23. # [[ -d "$SRC" ]] && rmdir "$SRC" >> "$LOG" 2>&1
  24. rm -rf "$SRC" >> "$LOG" 2>&1
  25. exit 0
  26. elif [ "$DIR" == "/" -o "$DIR" == "." ]; then
  27. echo `date` "ERROR " "$3" not under "$DOWNLOAD". >> "$LOG"
  28. exit 1
  29. else
  30. SRC=$DIR
  31. fi
  32. done
Add Comment
Please, Sign In to add comment