#!/usr/bin/perl`find /bak/ >list.txt`;open LIST,"/root/list.txt";while (){ chomp; open TEST,"$_"; if ( -d TEST ){ close TEST; } else{ close TEST; $mtime= -M $_; if ($mtime > 60){ print "$_ old than 60 day!!\n"; unlink $_; } }}
本文共 304 字,大约阅读时间需要 1 分钟。
#!/usr/bin/perl`find /bak/ >list.txt`;open LIST,"/root/list.txt";while (){ chomp; open TEST,"$_"; if ( -d TEST ){ close TEST; } else{ close TEST; $mtime= -M $_; if ($mtime > 60){ print "$_ old than 60 day!!\n"; unlink $_; } }}
转载于:https://www.cnblogs.com/hydezhao/p/3352254.html