in reply to some problem with date

Three bugs

Update: Changed the layout for readability, but not the content.

Replies are listed 'Best First'.
Re^2: some problem with date
by Anonymous Monk on Apr 13, 2007 at 15:00 UTC
    hi Ah the operator problems. oops very silly ,
    my($fileAgeInDays) = ((time() - (stat($eachFile))[9]) / 24 / 60 / 60);
    is there any alternate method to copy the yesterday's logs to some different folder.
      Date::Calc provides Delta_Days.
      use strict; use warnings; use Date::Calc qw( Delta_Days ); use File::Spec qw( catfile ); my ($y, $m, $d) = (localtime())[5, 4, 3]; $y += 1900; $m += 1; my $dir = ...; opendir(my $dh, $dir) or die("Unable to open log dir \"$dir\": $!\n"); while (my $file_name = readdir($dh)) { my $file_full = catfile($dir, $file_name); next if ! -f $file_full; my $mtime = (stat($file_full))[9]; my ($fy, $fm, $fd) = (localtime($mtime))[5, 4, 3]; $fy += 1900; $fm += 1; my $delta_days = Delta_Days(($y, $m, $d), ($fy, $fm, $fd)); if ($delta_days == 1) { ...copy the file... } }
        Hi sorry to bother you much. is it possible with the current code i have put in the top we can do something,the reason i am asking this is we have lots of procedure to install this modules in that box. Again i am sorry if i bother you much on this