#!/usr/bin/perl
use warnings;
use strict;
use diagnostics;
use File::Find;
sub eachFile {
my $filename = $_;
my $fullpath = $File::Find::name;
if (-e $filename) { print "$filename exists!\n"; }
if ($filename =~ /index.html.*/){
print "$filename need to be deleted\n";
system "rm $filename";
}
}
find (\&eachFile, "./");
####
index.html
index.html?C=D;O=D
####
index.html?C=S;O=D exists!
index.html?C=S;O=D need to be deleted
rm: cannot remove `index.html?C=S': No such file or directory