From 22d419a339dbfa569caa1f4ede3ec0033df56094 Mon Sep 17 00:00:00 2001 From: SuperNG6 Date: Thu, 16 Jan 2020 09:30:48 +0800 Subject: [PATCH] update delete.sh & delete.aria2.sh --- README.md | 4 ++++ root/aria2/script/delete.aria2.sh | 28 ++++++++++++++-------------- root/aria2/script/delete.sh | 31 ++++++++++++++----------------- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index e3f44dd..523b55e 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,10 @@ __当前的镜像或多或少都有以下几点不符合的我的需求__ # Changelogs +## 2020/01/15 + + 1、update delete.sh & delete.aria2.sh + ## 2020/01/10 1、增加arm64v8、arm32v7平台镜像 diff --git a/root/aria2/script/delete.aria2.sh b/root/aria2/script/delete.aria2.sh index 0818c2d..c475e78 100644 --- a/root/aria2/script/delete.aria2.sh +++ b/root/aria2/script/delete.aria2.sh @@ -7,18 +7,18 @@ rdp=${filepath#${downloadpath}/} path=${downloadpath}/${rdp%%/*} if [ $2 -eq 0 ] - then - exit 0 + then + exit 0 elif [ "$path" = "$filepath" ] && [ $2 -eq 1 ] - then - rm -vf "$filepath".aria2 - exit 0 -elif [ "$path" != "$filepath" ] && [ -e "$filepath".aria2 ] - then - rm -vf "$filepath".aria2 - exit 0 -elif [ "$path" != "$filepath" ] && [ -e "$path".aria2 ] - then - rm -vf "$path".aria2 - exit 0 -fi + then + [ -e "$filepath".aria2 ] && rm -vf "$filepath".aria2 + exit 0 +elif [ "$path" != "$filepath" ] && [ $2 -gt 1 ] + then + [ -e "$path".aria2 ] && rm -vf "$path".aria2 + exit 0 +elif [ "$path" != "$filepath" ] && [ $2 -eq 1 ] + then + [ -e "$filepath".aria2 ] && rm -vf "$filepath".aria2 + exit 0 +fi \ No newline at end of file diff --git a/root/aria2/script/delete.sh b/root/aria2/script/delete.sh index c0d0360..6b87e65 100644 --- a/root/aria2/script/delete.sh +++ b/root/aria2/script/delete.sh @@ -7,22 +7,19 @@ rdp=${filepath#${downloadpath}/} path=${downloadpath}/${rdp%%/*} if [ $2 -eq 0 ] - then - exit 0 + then + exit 0 elif [ "$path" = "$filepath" ] && [ $2 -eq 1 ] - then - rm -vf "$filepath".aria2 - rm -vf "$filepath" - exit 0 -elif [ "$path" != "$filepath" ] && [ -e "$filepath".aria2 ] - then - rm -vf "$filepath".aria2 - rm -vf "$filepath" - rmdir -v "${filepath%/*}" - exit 0 -elif [ "$path" != "$filepath" ] && [ -e "$path".aria2 ] - then - rm -vf "$path".aria2 - rm -vrf "$path" - exit 0 + then + [ -e "$filepath".aria2 ] && rm -vf "$filepath".aria2 "$filepath" + exit 0 +elif [ "$path" != "$filepath" ] && [ $2 -gt 1 ] + then + [ -e "$path".aria2 ] && rm -vrf "$path".aria2 "$path" + exit 0 +elif [ "$path" != "$filepath" ] && [ $2 -eq 1 ] + then + [ -e "$filepath".aria2 ] && rm -vf "$filepath".aria2 "$filepath" + find "${downloadpath}" ! -path "${downloadpath}" -depth -type d -empty -exec rm -vrf {} \; + exit 0 fi \ No newline at end of file