-
Notifications
You must be signed in to change notification settings - Fork 1
/
OneIndexupload.sh
47 lines (44 loc) · 971 Bytes
/
OneIndexupload.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
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
num="$2"
path="$3"
downloadpath='/root/Download' #下载目录
if [ $num -eq 0 ]
then
exit 0
fi
function getdir(){
IFS=$'\n';for file in `ls "$1"`
do
if [ -d "$1/$file" ]
then
getdir "$1/$file"
else
if [ "${1%/*}" = "$downloadpath" ] && [ $num -eq 1 ]
then
/usr/local/etc/OneDrive/onedrive "$1"
elif [ $num -eq 1 ]
then
/usr/local/etc/OneDrive/onedrive "$1/$file"
else
/usr/local/etc/OneDrive/onedrive -u "$downloadpath" "$1/$file"
fi
fi
done
}
while true; do
filepath=$path
path=${path%/*};
if [ "$path" = "$downloadpath" ]
then
getdir "$filepath"
if [ -d $filepath ]
then
rm -r "$filepath"
else
rm "$filepath"
fi
echo 3 > /proc/sys/vm/drop_caches
swapoff -a && swapon -a
exit 0
fi
done