<code>
opendir (DIR, "\\\\$server\\c\$\\sys\\data\\LOG\\updates");
@allfiles = readdir(DIR);
#print("," readdir(DIR));
#closedir(DIR);
foreach $f (@allfiles)
{
unless ( ($f eq ".") || ($f eq "..") )
{
print "$f\n";
(undef,undef,undef,$dom,$mon,$year)=localtime((stat($f))[9]);
$mon++;
$year += 1900;
$dateval = printf("%04d%02d%02d\n",$year,$mon,$dom);
}
</code>
the output of printf is: 19691231 for every file?
what am I doing wrong?
the date should be yesterdays date 20030915
TYAVM
From: Carl Jolley <[EMAIL PROTECTED]>
To: $Bill Luebkert <[EMAIL PROTECTED]>
CC: alex p <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
Subject: Re: newbie hlelp!
Date: Tue, 16 Sep 2003 01:49:48 -0400 (EDT)
On Mon, 15 Sep 2003, $Bill Luebkert wrote:
> alex p wrote:
>
> > Hello all,
> >
> > I am trying to figure out a way to get the "last modified" date of a file.
> > I have looked at the following modules but they dont seem to address what i
> > need: stat, utime, opendir
> >
> > does anyone know how to go about getting this date?
>
> stat should be fine : my $mtime = (stat $path)[9];
>
And then to convert the $mtime to something useful, give it to localtime(), e.g.
@date_fields=localtime($mtime); OR $The_last_mod_time=scalar localtime($mtime);
**** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer ****
_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_________________________________________________________________
Express yourself with MSN Messenger 6.0 -- download now! http://www.msnmessenger-download.com/tracking/reach_general
_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs