phpshell
root@test:/media/D///C+案例# cat 1.html|grep -nHo --color 'img_5'|wc -l
2
root@test:/media/D///C+案例# cat 1.html| sed -n '/<\/span>\/5/p'
<h2><b>(<span class="red" id="picturenum_list">1</span>/5)</b></h2>
root@test:/media/D///C+案例# for i in {1..10}; do cat 1.html|grep -nHo --color 'img_'$i|wc -l; done
2
2
2
2
2
0
0
0
0
0
root@test:/media/D///C+案例# for i in {1..20}; do result=`cat 1.html|grep -nHo --color 'img_'$i|wc -l`;if [ $result -gt 0 ] ; then echo "yes"; fi; done;
yes
yes
yes
yes
yes
root@test:/media/D///C+案例# for i in {1..29}; do result=`cat 4.html|grep -nHo --color 'img_'$i|wc -l`;if [ $result -gt 0 ] ; then echo $i; fi; done;
1
2
3
4
5
6
7
8
9
10
root@test:/media/D///C+案例# sed -i 's/<\/span>\/5/<\/span>\/10/' 4.htmlroot@test:/media/D///C+案例#
root@test:/var/www/html//# ls
C+案例 tag 百意效果图 金令案例展示 绿通案例 同济经典案例 印堂展会案例
ID城市空间案例 tag.tar.gz 非风格展会选图 坤然案例 欧碧雅方案 同济居家案例 质鼎案例
root@test:/var/www/html//# cd tag
root@test:/var/www/html///tag# ls
1130 fengge ganjue huxing jubu kongjian mianji shejishi wupin yanse yusuan
root@test:/var/www/html///tag# find . -type d
.
./kongjian
./yanse
./shejishi
./1130
./jubu
./fengge
./huxing
./wupin
./ganjue
./mianji
./yusuan
root@test:/var/www/html///tag# find . -type d ! -name 1130
.
./kongjian
./yanse
./shejishi
./jubu
./fengge
./huxing
./wupin
./ganjue
./mianji
./yusuan
root@test:/var/www/html///tag# find . -type d ! -name 1130|wc -l
11
root@test:/var/www/html///tag# find . -type d|wc -l
12
root@test:/var/www/html///tag# find . -type d ! -name 1130|wc -l
11
root@test:/var/www/html///tag# find . -type d ! -name 1130
.
./kongjian
./yanse
./shejishi
./jubu
./fengge
./huxing
./wupin
./ganjue
./mianji
./yusuan
root@test:/var/www/html///tag# find . -type d ! -name 1130 -exec rm -ri {} \;
rm: 无法删除目录:"."
rm:是否进入目录"./kongjian"? y
rm:是否删除普通文件 "./kongjian/1228.html"? ^C
root@test:/var/www/html///tag# find . -type d ! -name 1130 -exec rm -rfi {} \;
rm: 无法删除目录:"."
rm:是否进入目录"./kongjian"?
除却1130全部干掉
1 <?php
2 header("content-type:text/html;charset=utf-8");
3 $cmd="ls /var/www/html///";
4 #echo $cmd;
5 $list=exec($cmd,$out,$status);
6 #print_r($list);
7 foreach($out as $key=>$value){
8 $cmd="ls /var/www/html///".$value;
9 $output=array();
10 $list=exec($cmd,$output,$status);
11 echo "<pre>";
12 # print_r($output);
13 foreach($output as $k=>$v){
14 #echo "k=>".$k."<br>";
15 $img="../../..//".$value."/".$v."/img_1.jpg";
16 #echo $img;
17 $url="../../..//".$value."/".($k+1).".html";
18 #echo $url;
19 $str='<li class="collected">
20 <div class="imgbox">
21 <a href="'.$url.'" target="_blank"><img src="'.$img.'" onload="DrawImage1(this);"/></a>
22 </div>
23 <div class="describe">
24 <div class="title_b">C+创意空间</div>
25 </div>
26 <div class="type">
27 <dl>
28 田园风格
29 </dl>
30 </div>
31 </li>';
32 echo htmlentities($str);
33 echo "<br><br><br>";
34 }
35 echo "</pre>";
36
37 }
38
39
40 ?>
1 #<?php
2 #header("content-type:text/html;charset=utf-8");
3 #$shell="ls /var/www/html///C+案例/img_*.jpg";
4 #$shell="/media/D///ID城市空间案例";
5 #$shell='find /media/D///ID城市空间案例/银都路 -name "*.jpg"';
6 $shell="find /var/www/html///质鼎案例/ -name '*.jpg'";
7 $list=exec($shell,$out,$status);
8 #echo "<pre>";
9 #print_r($out);
10 #echo "</pre>";
11 #exit;
12 if(is_array($out)){
13 foreach($out as $key=>$value){
14 $tmp_file=$value;
15 echo "tmp_file=>".$tmp_file."<br>";
16 $water_img="/var/www/html/水印/质鼎.jpg";
17 imageWaterMark($tmp_file,$waterPos=9,$waterImage=$water_img,$waterText="",$fontSize=12,$textColor="#CCCCCC", $fontfile='./ar ial.ttf',$xOffset=0,$yOffset=0);
18 }
19 }
root@test:/var/www/html/imgtest# ls
img_1.jpg img_2.jpg img_3.jpg img_4.jpg img_5.jpg
root@test:/var/www/html/imgtest# j=0;for i in *.jpg
> do
> echo $i
> done
img_1.jpg
img_2.jpg
img_3.jpg
img_4.jpg
img_5.jpg
root@test:/var/www/html/imgtest# j=0;for i in *.jpg; do echo $i;let j=j+1;echo $j; done
img_1.jpg
1
img_2.jpg
2
img_3.jpg
3
img_4.jpg
4
img_5.jpg
5
root@test:/var/www/html/imgtest# j=0;for i in *.jpg; do echo $i;let j=j+1;echo $j;mv $i img$j.jpg; done
img_1.jpg
1
img_2.jpg
2
img_3.jpg
3
img_4.jpg
4
img_5.jpg
5
root@test:/var/www/html/imgtest# ls
img1.jpg img2.jpg img3.jpg img4.jpg img5.jpg
root@test:/var/www/html/imgtest# j=0;for i in *.jpg; do echo $i;let j=j+1;echo $j;mv $i img$j.jpg; done