xjkp[oaslk; 发表于 2015-12-28 14:13:24

perl 删除过期文件

#!/usr/bin/perl
`find /bak/ >list.txt`;
open LIST,"/root/list.txt";
while (<LIST>){
chomp;
open TEST,"$_";
if ( -d TEST ){
close TEST;
}
else{
close TEST;
$mtime= -M $_;
if ($mtime > 60){
print "$_ old than 60 day!!\n";
unlink $_;
}
}
}

  
页: [1]
查看完整版本: perl 删除过期文件