in reply to folder properties / modified date

bonjour Foggy Bottoms;

Perl for system administration, an extraordinarily handy book (David N. Blank-Edelman), gives the following as solutions to your problem: it allows you to watch in real time, if that is your penchant:

use Win32::AdvNotify; $aobj = new Win32::AdvNotify(); $thread = $aobj->StartThread(Directory => 'C:\monks', Filter => All, WatchSubtree => 0) or die "monkwatcher cannot start\n";


Filter Parameters can be more focused: ie changes in one of

FILE_NAME

DIR_NAME

ATTRIBUTES

SIZE

LAST_WRITE

CREATION

SECURITY

if all you are looking for is whether the directory size has changed, you can use the following:

use Win32::DirSize; chomp(my $dir = shift || <DATA>); my @dirstats; push @dirstats,sprintf("%-40s%-10s%-10s%-10s\n", "Directory", "Size", "FileCount", "DirCount"); if (dir_size($dir, my $dirstat) == DS_RESULT_OK){ my $size = best_convert(my $unit, $dirstat->{HighSize}, $dirstat->{LowSize}); my $filecount = $dirstat->{FileCount}; my $dircount = $dirstat->{DirCount}; push @dirstats, sprintf("%-40s%-10s%-10s%-10s\n", $dir, sprintf("%8.4f", $size) . $unit, $filecount, $dircount); } push @dirstats, undef; map { print } grep { defined } @dirstats; __DATA__ \\captains\nemo$\nautilus
hope that helps,

wufnik

-- in the world of the mules there are no rules --

Replies are listed 'Best First'.
Re: folder properties / modified date
by Foggy Bottoms (Monk) on Jul 21, 2003 at 13:25 UTC
    Thanks for your help - your node seems pretty comprehensive and I'll have a shot at it.
    I also tried snadra's idea which works fine on my NT4 system but doesn't work fine on Win2k. Any idea why ? Here's my bit of code...
    ####################### PRAGMA ####################### use strict; ####################### IMPORT ####################### use file::stat; my $file = "d:\\brossad\\"; # your own folder name here my @info = stat($file); my $last_access = $info[8]; my $last_modification = $info[9]; if (@info) { #print $last_access."\n"; my @time = (localtime($last_access)); $time[4]++; $time[5] += 1900; print ("time : $time[2]:$time[1]:$time[0] "."- $time[3]/$time[4]/$t +ime[5].\n"); } else { print "oops\n"; }
    It returns :
    time : 14:4:12 - 21/7/2003 on my machine
    , and
    time :  0:0:0  - 21/7/2003 on a Win2k machine... :(

    I checked the epoch time stamps (just to make sure the conversion bit wasn't the failing part) and the stamps are wrong under Win2k.
      I think I found out why time didn't come out for the
      last accessed
      property : it just doesn't exist in the Win98/2k folder properties - only the date is there. Oh well (sighs heavily).
      Thanks for your help.