linux 脚本实例  …

来源:互联网 发布:vb下载网页源代码 编辑:程序博客网 时间:2024/05/16 17:29


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
#!/bin/sh
#
#
#
#
########begin###########
stty erase ^h
read -p "Warning, if the file too much will cause greater burden on the system, and the time will be long, to continue it? (y Continue or Empty the last run cache or else Exit)
choose                   #Please do not change this code
case $choose in
        y|yes|Y|YES)
                echo
                ;;
        r|R)
                echo 
"Please wait"
                rm -rf /result
                
if "$?" -eq 0 ]
                  then
                        echo 
"Mission success"
                
else
                        echo 
"Mission faild"
                fi
                ;;

        *)
                echo 
"Bye~"
                exit
                ;;
esac
read -p "Ok,type the path you want to process
flie                  #Please do not change this code

while [[ 0 -eq 0 ]]; do

if -d $flie ]
  then
                echo 
"Please wait"
                sleep 
2
                ls -alfR $flie |grep -v 
"\/" |grep -v ^"\." |grep "\." |awk -F. '{printf "\n" $NF}' /tmp.tmp
                echo 
"\n"
                echo 
"I found those information"
                cat /tmp.tmp uniq
                
for name in `cat /tmp.tmp`
                do

                mkdir -p /result/$name
                cp `
find $flie -type -name "*.$name"/result/$name 2/dev/null
                done
                
break;
else
                
read -r -p "The path entered for the folder is not valid. Enter valid path.
flie
                continue
fi
done
 echo 
"You can see the file under /result. Each type of file will be placed in single folder."
 echo 
"Now,enjoy it."

原创粉丝点击