I couldn't find a PERL program to remove unwanted files from a directory
tree, like the one I use for my PCB designs with each design in a separate
sub-directory, which ends up cluttered with unwanted Backup, Security and
Report files. I therefore wrote my own, based on a directory listing program
I found. It might be useful to someone. I very rarely use PERL and it
probably shows. 8-)
#!/usr/bin/perl
use File::Find;
use strict;
my $directory = "c:/pcb";
find (\&process, $directory);
sub process
{
# Find files for deleting
if ( ($File::Find::name =~ /\bBackup\b/) or
($File::Find::name =~ /\bSecurity\b/) or
($File::Find::name =~ /\.txt$/) )
{
print $File::Find::name;
print "\n";
unlink $File::Find::name;
}
}
The Pulsonix software I use creates Backup and Security files with names
starting with "Backup Copy of" and "Security Copy of" respectively and
report files all have a .txt extension.
Leon
--
Leon Heller, G1HSM
http://www.geocities.com/leon_heller