Chris Van Vleet wrote:
> 
> All,
> 
> I would appreciate any help in where/how to reference a variable within the 
>operating system (Registry Editor?) of Windows NT?
> 
> I'm writing a Perl script that checks the time a file was last modified and 
>determines if time is gt 24 hours. The output is simply the path/filename. Pretty 
>straight forward.
> 
> I need to reference the variable(s) unto which a files' 'time last modified' is 
>stored, determine if scalar, array, etc. (i think the variable contains date & time 
>info.) See sample code below as reference. Any advice is appreciated.
> 
> $time = time;  # time function returns number of non-leap sec since 1/1/70
> $mtime, # LAST MODIFY TIME SINCE THE EPOCH (1/1/70)
> 
> # subtract last modification time from current time and divide by number of
> # seconds in 24 hours
> 
> $days = ($time - $mtime)/86400;

use strict;

my $dir = '.';
my $file = 'fubar.txt';

# using stat

my $mtime = (stat "$dir/$_")[9];
if (time - $mtime > 86400) {
        # file is more than 1 day old
}

# using -M

if (-M "$dir/$_" > 1.0) {
        # file is more than 1 day old
}


-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
 (_/   /  )    // //       DBE Collectibles   http://www.todbe.com/
  / ) /--<  o // //      Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/_<_</_</_    http://www.freeyellow.com/members/dbecoll/
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to