Skynet

          ---------- ---------- 我的新 blog : liukaiyi.cublog.cn ---------- ----------

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            112 Posts :: 1 Stories :: 49 Comments :: 0 Trackbacks
          使用 File::Find
          use File::Find;
          use Time::Piece;


          $timeOneDay = 86400;
          $dayMultipler = 1;

          $ByteCount = 0;
          $fileAll = 0;
          $fileJpg = 0;
          $fileYes = 0;
          $pathToTra = ".";

          $gt = localtime;
          $t1 = $gt->epoch;
          find(
          \&fileThumb, $pathToTra);
          $gt = localtime;
          $t2 = $gt->epoch;

          print "Total KByte: ".($ByteCount/1024)."\n";
          print "Total Scan:  ".$fileAll."\n";
          print "Total Jpeg:  ".$fileJpg."\n";
          print "Total Match: ".$fileYes."\n";
          print "Total TimeCost: ".($t2-$t1)."\n";

          sub fileThumb
          {
             
          $fileAll++;
             
          if ((/.*\.jpg$/) )
             {   
                
          $fileJpg++;
                
          my $lt = 0;
                
          $lt = localtime;

                
          my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks= stat($_)  or die "Unable to stat $_\n";           
                
          if ( $mtime < ($lt->epoch - $timeOneDay*$dayMultipler) )
                {
                   
          print "[ $fileYes ]"."$File::Find::name";
                   
          print $size." ".$ctime." ".$lt->epoch."\n";
                   
          $ByteCount += $size;
                   
          $fileYes++;
                }
             }
          }



           



          整理 www.aygfsteel.com/Good-Game
          posted on 2009-02-23 23:55 劉凱毅 閱讀(459) 評論(0)  編輯  收藏 所屬分類: perl
          主站蜘蛛池模板: 湖北省| 新民市| 如皋市| 江源县| 乌拉特前旗| 噶尔县| 南充市| 元朗区| 阳山县| 太康县| 慈溪市| 孟村| 开封市| 商城县| 城步| 梅州市| 邢台县| 凤凰县| 温宿县| 临武县| 囊谦县| 左云县| 湖口县| 伊吾县| 涞水县| 南京市| 恩施市| 新田县| 博爱县| 惠州市| 赫章县| 伽师县| 图木舒克市| 吉安市| 临澧县| 康平县| 武强县| 台南市| 贞丰县| 泰州市| 乌拉特前旗|