Getting modification dates of files

I have a script, that needs to do a glob() type list, and get not only file names, but their modification dates as well.  I will use this to search through a directory, and delete files that were modified over a day ago.
7thwaveAsked:
Who is Participating?
 
RoboBobConnect With a Mentor Commented:
#!/usr/local/bin/perl -w
#####################
foreach $file (</put/dir/here/*>) {
    if(-M $file > 1) { unlink($file); }
}

or, do it the easy way, from the command line with find...
find -mtime +1 -exec rm {} \;
0
 
ozoCommented:
In what language is the script written?
0
 
7thwaveAuthor Commented:
The script is in perl
0
 
ozoCommented:
(stat $filename)[9]
is the modification date
-M $filename
is the number of days since it was last modified (at the time the script was started)
0
All Courses

From novice to tech pro — start learning today.