Check disk usage with Windows Standard Perl Modules [beginner]

Discussion in 'Perl Misc' started by Rui Vilao, Oct 14, 2003.

  1. Rui Vilao

    Rui Vilao Guest

    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.
     
    Rui Vilao, Oct 14, 2003
    #1
    1. Advertising

  2. Rui Vilao

    ko Guest

    (Rui Vilao) wrote in message news:<>...
    > 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
     
    ko, Oct 15, 2003
    #2
    1. Advertising

  3. Rui Vilao

    ko Guest

    (Rui Vilao) wrote in message news:<>...
    > 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
     
    ko, Oct 15, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jas Shultz
    Replies:
    0
    Views:
    967
    Jas Shultz
    Dec 3, 2003
  2. Tapestry disk usage

    , Oct 25, 2005, in forum: Java
    Replies:
    10
    Views:
    609
    Roedy Green
    Oct 27, 2005
  3. Replies:
    12
    Views:
    529
    santosh
    Nov 15, 2006
  4. Sankar
    Replies:
    12
    Views:
    458
    William Ahern
    Dec 6, 2006
  5. Sankar
    Replies:
    8
    Views:
    271
    CBFalconer
    Dec 5, 2006
Loading...

Share This Page