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 --
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.