Thanks#!/usr/bin/perl -w $dir = "c:/mydocu~1/Netscape/Suitespot"; print "Starting Delete Process\n"; print "\n"; opendir(DIR, "$dir") || die "No $dir: $!"; @files = grep(!/^\./, readdir(DIR)); @files = sort @files; foreach(@files) { print "$_\n"; next if ($_ !~ /^\.log$/i); next if ($_ !~ /^\.\d+\w+\-\d+\wm$/i); next if ($_ !~ /^\.txt$/i); unlink "$dir/$_" || print "Unable to delete $_: $!"; } print "\n"; print "Deleted all requested files.\n"; closedir(DIR);
In reply to Removing files with extentions of log and date-time. by curtisb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |