in reply to Removing files with extentions of log and date-time.

#!/usr/bin/perl -w use strict; my $dir = 'path to directory'; opendir (DIR, "$dir") || die "Cannot open directory: $!\n"; print "Starting Delete Process\n\n"; while ($_ = readdir(DIR)) { print $_, "\n"; unless (/^\./) { if (/\.log$/i or /\.\d+\w+\-\d+\wm$/i or /\.txt$/i) { unlink("$dir/$_") if (-f "$dir/$_") || warn "Cannot delete $_: $!\n"; } } } print "\nDeleted all requested files.\n"; closedir(DIR);
As Dermot says, im not sure about that time/date expression of yours, so please post the date format.
I tested this code and it works just fine on my linux box, i guess you have to change the shebang. Both in my and your code.
This will delete all files with extention log, txt or date/time.
Update: added unless{} to not touch files that start with "." (didn't know they where allowed in windows ;)