hawl 发表于 2015-12-28 14:46:09

perl File::Find模块

1 #遍历一个文件夹
2
3 use File::Find;
4
5 my $path = '/home/test/';
6 sub process
7 {
8   if ( -f $File::Find::name )
9   {
10         if ( $File::Find::name =~ /\.old$/ )
11         {
12             print "$File::Find::name\n";
13         }
14   }
15 }
16
17 find( \&process, $path );
页: [1]
查看完整版本: perl File::Find模块