From 92e96512670b97d9e84b46ebfa983e078e6952bb Mon Sep 17 00:00:00 2001 From: P3TERX Date: Sat, 8 Jun 2019 15:34:41 +0800 Subject: [PATCH] =?UTF-8?q?Update=202019-06-08=20=E9=99=84=E5=8A=A0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E8=84=9A=E6=9C=AC=EF=BC=88`autoupload.sh`?= =?UTF-8?q?=EF=BC=89=EF=BC=9A=20*=20=E4=BC=98=E5=8C=96=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91=20*=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20BT=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6=E5=A4=B9?= =?UTF-8?q?=E4=B8=8B=E6=89=80=E6=9C=89=E6=96=87=E4=BB=B6=E6=97=B6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E6=97=A0=E6=B3=95=E5=88=A4=E6=96=AD=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ autoupload.sh | 15 ++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 856029a..729beb3 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,11 @@ ~~`dht6.dat` DHT(IPv6)文件~~ ## 更新日志 +### 2019-06-08 +附加功能脚本(`autoupload.sh`): +* 优化 路径判断逻辑 +* 修复 BT下载文件夹下所有文件时路径无法判断的 bug + ### 2019-05-23 附加功能脚本(`autoupload.sh`): * 移除上传大小限制 diff --git a/autoupload.sh b/autoupload.sh index 078da2d..984acb1 100644 --- a/autoupload.sh +++ b/autoupload.sh @@ -1,6 +1,6 @@ #!/bin/bash #Description: Aria2 download completes calling Rclone upload -#Version: 1.5 +#Version: 1.6 #Author: P3TERX #Blog: https://p3terx.com @@ -20,15 +20,15 @@ Task_INFO(){ echo -e "\033[1;35mDownload path:\033[0m${downloadpath}" echo -e "\033[1;35mFile path: \033[0m${filepath}" echo -e "\033[1;35mUpload path: \033[0m${uploadpath}" - echo -e "\033[1;35m.aria2 file path: \033[0m${aria2file}" echo -e "\033[1;35mRemote path:\033[0m${remotepath}" echo -e "-------------------------- [\033[1;33mINFO\033[0m] --------------------------" echo } Upload(){ - rclone move -v "${uploadpath}" "${remotepath}" - rm -vf "${aria2file}" #删除.aria2文件 + rclone move -v "${uploadpath}" "${remotepath}" #上传 + rm -vf "${path}".aria2 + rm -vf "${filepath}".aria2 rclone rmdirs -v "${downloadpath}" --leave-root #删除空目录 } @@ -44,23 +44,20 @@ echo && echo -e " \033[1;35mU P L O A D ! ! !\033[0m" && echo if [ "$path" = "$filepath" ] && [ $2 -eq 1 ] #普通单文件下载,移动文件到设定的网盘文件夹。 then uploadpath=${filepath} - aria2file="${filepath}".aria2 #.aria.2文件在下载目录中 remotepath="${name}:${folder}" Task_INFO Upload exit 0 -elif [ "$path" != "$filepath" ] && [ -e "$path".aria2 ] #文件夹下载(BT下载),移动整个文件夹到设定的网盘文件夹。 +elif [ "$path" != "$filepath" ] && [ $2 -gt 1 ] #BT下载(文件夹内文件数大于1),移动整个文件夹到设定的网盘文件夹。 then uploadpath=${path} - aria2file="${path}".aria2 #.aria2文件在下载目录中 remotepath="${name}:${folder}/${rdp%%/*}" Task_INFO Upload exit 0 -elif [ "$path" != "$filepath" ] && [ $2 -eq 1 ] #子文件夹或多级目录等情况下的单文件下载(第三方度盘工具),移动文件到设定的网盘文件夹下的相同路径文件夹。 +elif [ "$path" != "$filepath" ] && [ $2 -eq 1 ] #第三方度盘工具下载(子文件夹或多级目录等情况下的单文件下载)、BT下载(文件夹内文件数等于1),移动文件到设定的网盘文件夹下的相同路径文件夹。 then uploadpath=${filepath} - aria2file="${filepath}".aria2 #.aria2文件在文件夹中 remotepath="${name}:${folder}/${rdp%/*}" Task_INFO Upload