in reply to find "x" quantity newest files in a dir
This does what you're looking for : it's from File Attributes in Win32. All you need to do is change the -A to -M or whatever. Feel free to hack the code as much as you like.
Azatoth a.k.a Captain Whiplash
Make Your Die Messages Full of Wisdom!
Get YOUR PerlMonks Stagename here!
Want to speak like a Londoner?
Update: Actually this doesn't do what you're looking for, but the code will help you on your way...#!perl -w use strict; print "Enter Directory Path : \n"; chomp(my $dirPath = <STDIN>); opendir (DIR, "$dirPath") || die "Fscked Filesystem: $!\n"; my @fileList = grep(!/^\.\.?$/, readdir (DIR)); closedir (DIR); foreach my $file (@fileList) { check_files($file,$dirPath); } ## SUBS ## sub check_files { my $file = shift; my $dirPath = shift; if (-A $file > 30) { print "$file has not been used for over 30 days. De +lete? [y/n]\n"; chomp(my $ans = <STDIN>); if ($ans =~ /^y/) { unlink ("$dirPath\\$file") || die "Could Not + Remove $file : $!\n"; print "Deleting $dirPath\\$file...\n"; } else { print "Skipping File...\n"; } } }
Azatoth a.k.a Captain Whiplash
Make Your Die Messages Full of Wisdom!
Get YOUR PerlMonks Stagename here!
Want to speak like a Londoner?
In Section
Seekers of Perl Wisdom