#!perl -w use strict; print "Enter Directory Path : \n"; chomp(my $dirPath = ); 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. Delete? [y/n]\n"; chomp(my $ans = ); if ($ans =~ /^y/) { unlink ("$dirPath\\$file") || die "Could Not Remove $file : $!\n"; print "Deleting $dirPath\\$file...\n"; } else { print "Skipping File...\n"; } } }