Check disk usage with Windows Standard Perl Modules [beginner]

R

Rui Vilao

Greetings,

I am starting with Perl for Windows System Administration…

I want to write a script that keeps on running and checks periodically
if some drives utilization exceeds a given threshold… and runs a purge
job if necessary (BackupExec archive job).

Is there a function within a standard Perl module I can use for this
(e.g. Win32::File)?

Any help/suggestion is highly appreciated.

Thanks in advance for your help,

Kind Regards,

Rui Vilao.
 
K

ko

Greetings,

I am starting with Perl for Windows System Administration?

I want to write a script that keeps on running and checks periodically
if some drives utilization exceeds a given threshold? and runs a purge
job if necessary (BackupExec archive job).

Is there a function within a standard Perl module I can use for this
(e.g. Win32::File)?

Any help/suggestion is highly appreciated.

Thanks in advance for your help,

Kind Regards,

Rui Vilao.


ActiveState includes Win32::ChangeNotify, which allows, among other
things, monitoring directory trees for size changes. The docs are kind
of sparse. You might try a Google search if you need more info.

Your other alternative is to write a recursive routine - one possible
way to do this is with File::Find and stat().

HTH - keith
 
K

ko

Greetings,

I am starting with Perl for Windows System Administration?

I want to write a script that keeps on running and checks periodically
if some drives utilization exceeds a given threshold? and runs a purge
job if necessary (BackupExec archive job).

Is there a function within a standard Perl module I can use for this
(e.g. Win32::File)?

Any help/suggestion is highly appreciated.

Thanks in advance for your help,

Kind Regards,

Rui Vilao.

W2K and above (don't know about anything before W2K) also allow
another alternative, du, which I neglected in previous post:

use strict;
use warnings;

my $total;
my @sizes = `du DRIVE_OR_DIRECTORY`; # capture du output w/backticks
foreach (@sizes) {
(my $size) = $_ =~ /^(\d+)/;
$total += $size;
}
print "$total\n";

Then compare $total to whatever the quota is and run the
backup/archive.

HTH - keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top