Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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

by Kanji (Parson)
on Jul 16, 2002 at 02:08 UTC ( #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){


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2022-10-06 16:50 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (26 votes). Check out past polls.