Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Win32 low disk-space-free, with email notification

by Kanji (Parson)
on Jul 16, 2002 at 02:08 UTC ( [id://181981]=note: print w/replies, xml ) Need Help??


in reply to (code) Win32 disk monitor, email notify, event log

my @drives=Win32::AdminMisc::GetDrives(DRIVE_FIXED);

If you have any SUBSTed 'drives', GetDrives() will list those as if they were additional drives, which may or may not be what you want (I imagine it'd matter more if you had seperate alarms for each drive).

I'm not familiar with Win32::AdminMisc, but I got around this using Win32::DriveInfo's VolumeInfo...

foreach my $drive ( Win32::DriveInfo::DrivesInUse ) { next unless Win32::DriveInfo::DriveType($drive) == FIXED_DISK; my $serial = (Win32::DriveInfo::VolumeInfo($drive))[1]; next if $seen{$serial}++; }

Also, what happens if you have 0 bytes free? Won't the below cause your script to skip over it? (Forgive my ignorance if GetDriveSpace() returns some sort of '0 but true' string instead...)

  if($total && $free){

    --k.


Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://181981]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-29 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found