forked from jdpedersen1/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fileupdate.sh
executable file
·48 lines (45 loc) · 1.31 KB
/
fileupdate.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
count=$(ls ./ | grep $1 | wc -l)
dir1="$HOME/Documents/"
dir2="$HOME/.local/scripts/"
dir3="$HOME/Documents/school/"
for file in ./*.$1 "$2"
do
if [ -f "${file}" ] && [ -z "$2" ]; then
if [[ "$file" == *.txt ]]
then
mv "$file" "$dir1"
if [ "$count" -gt "1" ]; then
notify-send "All $1 files successfully moved"
else
notify-send "$file successfully moved"
fi
elif
[[ "$file" == *.sh ]]
then
mv "$file" "$dir2"
if [ "$count" -gt "1" ]; then
notify-send "All $1 files successfully moved"
else
notify-send "$file successfully moved"
fi
else
[[ $file == *.docx ]]
mv "$file" "$dir3"
if [ "$count" -gt "1" ]; then
notify-send "All $1 files successfully moved"
else
notify-send "$file successfully moved"
fi
fi
else
if [ -f "${file}" ] && [ "$2" ]; then
mv "$file" "$2"
if [ "$count" -gt "1" ]; then
notify-send "All $1 files successfully moved"
else
notify-send "$file successfully moved"
fi
fi
fi
done