forked from P3TERX/aria2.conf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.aria2.sh
37 lines (33 loc) · 1.04 KB
/
delete.aria2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#=================================================================
# https://github.com/P3TERX/aria2.conf
# File name:delete.aria2.sh
# Description: Delete .aria2 file after Aria2 download is complete
# Lisence: MIT
# Version: 1.9
# Author: P3TERX
# Blog: https://p3terx.com
#=================================================================
# Aria2下载目录
# TIPS:一键脚本推荐使用选项进行修改,Docker 无需修改。
downloadpath='/root/Download'
#=================================================================
filepath=$3
rdp=${filepath#${downloadpath}/}
path=${downloadpath}/${rdp%%/*}
if [ $2 -eq 0 ]
then
exit 0
elif [ "$path" = "$filepath" ] && [ $2 -eq 1 ]
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