-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdownoladSort.sh
More file actions
executable file
·67 lines (64 loc) · 1.19 KB
/
downoladSort.sh
File metadata and controls
executable file
·67 lines (64 loc) · 1.19 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
#scrit to sort my downloads
move()
{
folder="/home/misi/Downloads/$2"
file="/home/misi/Downloads/$1"
if [ -d $folder ]
then
mv $file $folder
else
mkdir $folder
mv $file $folder
fi
}
files=$(ls ~/Downloads -p | grep -v /)
IFS=$'\n'
for i in $files
do
ext=$(echo $i | awk -F "." '{print $NF}')
#echo $ext
if [ $ext = "jpg" ] || [ $ext = "gif" ] || [ $ext = "png" ] || [ $ext = "jpeg" ] || [ $ext = "svg" ]
then
echo "image"
move $i image
elif [ $ext = "torrent" ]
then
echo "torrent"
move $i torrent
elif [ $ext = "pdf" ]
then
echo "pdf"
move $i pdf
elif [ $ext = "odf" ] || [ $ext = "docx" ] || [ $ext = "doc" ] || [ $ext = "odt" ] || [ $ext = "ppt" ]
then
echo "doc"
move $i doc
elif [ $ext = "zip" ] || [ $ext = "gz" ] || [ $ext = "xz" ] || [ $ext = "rar" ] || [ $ext = "tar" ]
then
echo "compresd"
move $i compresed
elif [ $ext = "jar" ]
then
echo "jar"
move $i jar
elif [ $ext = "deb" ]
then
echo "deb"
move $i deb
elif [ $ext = "mp3" ]
then
echo "audio"
move $i audio
elif [ $ext = "mkv" ] || [ $ext = "mp4" ]
then
echo "video"
move $i video
elif [ $ext = "iso" ]
then
echo "iso"
move $i iso
else
echo "else $ext"
fi
done