#在c:\查找findfile.pl文件
#!/usr/bin/perl -w
use strict;
use File::Find;
sub wanted {
if ($_ eq "findfile.pl") {
print $File::Find::name;
}
}
find (\&wanted,'c:/');
#在c:\下删除所有以.temp结尾的文件
#!/usr/bin/perl -w
use strict;
use File::Find;
sub wanted {
if (-f $File::Find::name) {
if ($File::Find::name=~/\.temp$/) {
print "Removing $File::Find::name\n";
unlink $File::Find::name;
}
}
}
find (\&wanted,'c:/');
#!/usr/bin/perl -w
use strict;
use File::Find;
print "Starting to clean all \.keep file in current directory:\n";
sub wanted {
if (-f $File::Find::name) {
if ($File::Find::name=~/\.keep$/) {
print "Removing $File::Find::name\n";
unlink $File::Find::name;
}
}
}
find (\&wanted,'c:/','d:/','e:/');
阅读(884) | 评论(0) | 转发(0) |