Created
January 15, 2018 05:32
-
-
Save benzBrake/cf5df0aa7e3f2ab01d1352820859d3bb 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 | |
# $1 is gid. | |
# $2 is the number of files. | |
# $3 is the path of the first file. | |
DOWNLOAD=/data/aria2/download # no trailing slash! | |
COMPLETE=/data/aria2/gg # no trailing slash! | |
LOG=/data/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 | |
echo `date` "INFO " "$SRC" moved as "$SRC". >> "$LOG" | |
mv "$SRC" "$COMPLETE" >> "$LOG" 2>&1 | |
exit $? | |
elif [ "$DIR" == "/" -o "$DIR" == "." ]; then | |
echo `date` ERROR "$SRC" not under "$DOWNLOAD". >> "$LOG" | |
exit 1 | |
else | |
SRC=$DIR | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment