better failed delete/move options #98

if no failed folder is specified, it won't move
if specified, files are moved to category sub directory, in their own nzbname directory.
And a test to ensure we don't delete the config directory.
This commit is contained in:
Clinton Hall 2013-03-23 13:49:39 -07:00
commit b1a02c228a

View file

@ -221,13 +221,16 @@ do_exit() {
if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing function 'do_exit' with argument $1" | tee -a $tmplog; fi
nzbStatus=0
if [ "$1" -ne "$POSTPROCESS_SUCCESS" ]; then
if [ "$Delete_Failed" = "yes" ]; then
cd $NZBPP_DIRECTORY
if [ "$Delete_Failed" = "yes" -a "$NZBPP_DIRECTORY" != "$ConfigDir" ]; then
rm * >/dev/null 2>&1
cd ..
rmdir $NZBPP_DIRECTORY
else
elif [ "$NZBPP_DIRECTORY" != "$ConfigDir" -a "$Failed_Directory" != "" ]
mkdir $Failed_Directory
mv * $Failed_Directory >/dev/null 2>&1
mkdir $Failed_Directory/$NZBPP_CATEGORY
mkdir $Failed_Directory/$NZBPP_CATEGORY/$NZBPP_NZBNAME
mv * $Failed_Directory/$NZBPP_CATEGORY/$NZBPP_NZBNAME >/dev/null 2>&1
cd ..
rmdir $NZBPP_DIRECTORY
NZBPP_DIRECTORY=$Failed_Directory