Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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){

    --k.



Comment on Re: Win32 low disk-space-free, with email notification
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2014-10-26 00:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls