use strict;
use File::Find;
sub wanted {
# Check to see if the filename is not a directory
if ( -f $File::Find::name ) {
# Verify the filename eds in .tmp
if ( $File::Find::name=~/\.test.txt$/i) # Give the file name you want to delete
{
print “Removing $File::Find::name\n”;
unlink $File::Find::name;
}
}
}
find(\&wanted, ‘d://Test’); # Give the path from where you want to delete the files
No comments:
Post a Comment