Re: file access dates
- From: "Paul Lalli" <mritty@xxxxxxxxx>
- Date: 27 Feb 2006 09:46:54 -0800
wellercs@xxxxxxxxx wrote:
Hi, I am new to perl, and I want to search a root directory and find
files that have not been accessed within the last 6 months. I have
found that the stat function returns an array of file info. Could
someone please tell me which element the last accessed date is?
Yes, the authors of the documentation can tell you that.
stat Returns a 13-element list giving the status info for
a file,
<snip>
Not all fields are supported on all filesystem
types. Here are the meanings of the fields:
<snip>
8 atime last access time in seconds since the epoch
<snip>
Also
if there is a better way than using stat, please point me in the right
direction.
Again, please check the documenation for the function you're using,
before asking thousands of people around the world to read it to you:
The File::stat module provides a convenient, by-name
access mechanism:
use File::stat;
$sb = stat($filename);
printf "File is %s, size is %s, perm %04o, mtime
%s\n",
$filename, $sb->size, $sb->mode & 07777,
scalar localtime $sb->mtime;
Paul Lalli
.
- Follow-Ups:
- Re: file access dates
- From: usenet
- Re: file access dates
- References:
- file access dates
- From: wellercs@xxxxxxxxx
- file access dates
- Prev by Date: Re: replacing multiple elsif statements question
- Next by Date: Re: problems parsing a DHCP.leases file.
- Previous by thread: file access dates
- Next by thread: Re: file access dates
- Index(es):
Relevant Pages
|