perl file find

简介:
使用 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 ++ ;
      }
   }
}
本文转自博客园刘凯毅的博客,原文链接:perl file find,如需转载请自行联系原博主。


 




目录
相关文章
|
监控 Linux Python
Centos 7.0 execute yum update ——File "/usr/libexec/urlgrabber-ext-down", line 75, in <module>
Centos 7.0 execute yum update ——File "/usr/libexec/urlgrabber-ext-down", line 75, in <module>
185 0
Centos 7.0 execute yum update ——File "/usr/libexec/urlgrabber-ext-down", line 75, in <module>
|
C语言 Python Windows
gcc: error: /FIPython.h: File o directory non esistente
gcc: error: /FIPython.h: File o directory non esistente
119 0
Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)Call Stack
Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)Call Stack
499 0
Can‘t exec “aclocal“: 没有那个文件或目录 at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
Can‘t exec “aclocal“: 没有那个文件或目录 at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
346 0
Can‘t exec “autopoint“: 没有那个文件或目录 at /usr/share/autoconf/Autom4te/FileUtils.pm line 345.
Can‘t exec “autopoint“: 没有那个文件或目录 at /usr/share/autoconf/Autom4te/FileUtils.pm line 345.
487 0
configure: error: Can‘t find ext2fs library
configure: error: Can‘t find ext2fs library
247 0
|
算法框架/工具 Caffe
File "/usr/local/lib/python3.5/site-packages/dateutil/rrule.py", line 55 raise ValueError
File "/usr/local/lib/python3.5/site-packages/dateutil/rrule.py", line 55 raise ValueError
113 0
|
关系型数据库 MySQL 应用服务中间件
linux篇-Parse error: syntax error, unexpected ‘new’ (T_NEW) in /usr/local/nginx/html/cacti/lib/adodb
linux篇-Parse error: syntax error, unexpected ‘new’ (T_NEW) in /usr/local/nginx/html/cacti/lib/adodb
176 0
linux篇-Parse error: syntax error, unexpected ‘new’ (T_NEW) in /usr/local/nginx/html/cacti/lib/adodb
|
Linux
【Linux】locate: can not stat () `/var/lib/mlocate/mlocate.db‘: No such file or directory
【Linux】locate: can not stat () `/var/lib/mlocate/mlocate.db‘: No such file or directory
216 0
【Linux】locate: can not stat () `/var/lib/mlocate/mlocate.db‘: No such file or directory
FileNotFoundError: Could not find module ‘D:\ProgramData\Anaconda3\Library\bin\geos_c.dll‘
FileNotFoundError: Could not find module ‘D:\ProgramData\Anaconda3\Library\bin\geos_c.dll‘
990 0