disk space script

Discussion in 'Perl Misc' started by Bernd, Jan 12, 2005.

  1. Bernd

    Bernd Guest

    Hello Newsgroup,

    Anyone has a little Perlscript which could
    give me the disk space left on all disks on a windows
    system (nt, w2k, w3k servers?)?
    And best of, the Disk space all in all? on each Disk?
    Google did not help that much in this case.

    Bernd
    Bernd, Jan 12, 2005
    #1
    1. Advertising

  2. Bernd

    jc8glp1hu Guest

    Bernd

    You may want to check out this page. It is a list of all of XP's
    commands for cmd.

    http://www.ss64.com/nt/

    So with perl you can just use system() or exec() to output to the
    command line.

    the only issue may be reading it back in .. in that case do a system()
    > diskinfo.txt and read it back in w/ your application then remove it

    when you are done w/ it.

    That's what I do w/ perl on a Unix environment, so maybe itll work for
    you on windows.

    Cheers
    jc8glp1hu, Jan 12, 2005
    #2
    1. Advertising

  3. Bernd

    jc8glp1hu Guest

    Wow, google really butchers the text as you enter it! that system line
    with the right arrow thing is supposed to be one line.
    jc8glp1hu, Jan 12, 2005
    #3
  4. Bernd

    Bernd Guest

    THX!
    i will check out the Tips...
    Bernd
    Bernd, Jan 13, 2005
    #4
  5. Bernd

    Anno Siegel Guest

    jc8glp1hu <> wrote in comp.lang.perl.misc:

    [unattributed original posting snipped]

    > So with perl you can just use system() or exec() to output to the
    > command line.
    >
    > the only issue may be reading it back in .. in that case do a system()
    > > diskinfo.txt and read it back in w/ your application then remove it

    > when you are done w/ it.
    >
    > That's what I do w/ perl on a Unix environment, so maybe itll work for
    > you on windows.


    If that's how you're doing it, you're doing it wrong. Look up "qx" in
    perlop.

    Anno
    Anno Siegel, Jan 13, 2005
    #5
  6. Bernd

    jc8glp1hu Guest

    Ahh, nifty. I didn't know about that. I don't use perl too much for
    shell scripting and at the time I didn't have the extra minutes to look
    up any other way to do it.

    Thanks for the tip, but if it works, its technically not wrong. It's
    just not as efficient :), hehehe.

    For any others who weren't aware of qx, I wrote a few lines to spit
    some stuff out and demonstrate its use.

    #!/usr/bin/perl
    use strict;

    my $list = qx(ls);

    print $list . "\n";

    my @arr = split(/\\n/,$list);
    print "Array Test\n";
    foreach my $v (@arr) {
    print $v . "\n";
    }
    jc8glp1hu, Jan 14, 2005
    #6
  7. Bernd

    Anno Siegel Guest

    jc8glp1hu <> wrote in comp.lang.perl.misc:

    Please quote enough of what you are replying to so people know what
    you are replying to.

    [OP catches program output in a file and reads file. qx() was suggested
    instead]

    > Ahh, nifty. I didn't know about that. I don't use perl too much for
    > shell scripting and at the time I didn't have the extra minutes to look
    > up any other way to do it.
    >
    > Thanks for the tip, but if it works, its technically not wrong. It's
    > just not as efficient :), hehehe.


    You may be able to row a boat using a dust pan, but onlookers would
    agree you're doing it wrong.

    Anno
    Anno Siegel, Jan 14, 2005
    #7
  8. jc8glp1hu <> wrote:

    > Ahh, nifty. I didn't know about that.



    What "that" is that?

    It is customary to quote some context.

    Please learn the proper way of composing a followup.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Jan 14, 2005
    #8
  9. Bernd

    jc8glp1hu Guest

    Sorry

    Tad McClellan wrote:
    > What "that" is that?


    that = qx()

    .. I didn't quote because it was from the post above. I'll work on it, I
    am new to the whole forum type / google grouping. Thanks for the
    advice.
    jc8glp1hu, Jan 14, 2005
    #9
  10. Bernd

    Paul Lalli Guest

    "jc8glp1hu" <> wrote in message
    news:...
    > Sorry
    >
    > Tad McClellan wrote:
    > > What "that" is that?

    >
    > that = qx()
    >
    > . I didn't quote because it was from the post above. I'll work on it,

    I
    > am new to the whole forum type / google grouping. Thanks for the
    > advice.


    This is not google groups, nor is it a forum. This is Usenet. Google
    merely provides an interface and an archive. Please use that archive to
    search for an article entitled "Posting Guidelines". Following those
    guidelines will help maximize the help you receive in this newsgroup.

    Paul Lalli
    Paul Lalli, Jan 14, 2005
    #10
  11. "jc8glp1hu" <> writes:
    >
    > Tad McClellan wrote:
    > > What "that" is that?

    >
    > that = qx()
    >
    > . I didn't quote because it was from the post above. I'll work on it, I
    > am new to the whole forum type / google grouping. Thanks for the
    > advice.


    The "post above" is visible to you, but for most people reading News
    with a News reader, an article they've already read is not visible
    anymore because they read it in an earlier session. It may perhaps not
    even be obtainable locally anymore, if enough time has passed - old
    articles are removed to save space. On www.dejanews.com, you can see
    the complete thread.

    Apart from that, the article you refer to may not appear as the one
    immediately above, for everyone.

    Third, if they choose to comment on what you wrote, it becomes
    increasingly difficult to keep track of what is being referred to.
    Arndt Jonasson, Jan 14, 2005
    #11
  12. jc8glp1hu wrote:

    > am new to the whole forum type / google grouping.


    Okay, here's a friendly tip then: This isn't "Google Groups". It's Usenet.

    Google is simply a web-based front end to Usenet - and a particularly bad
    one at that. If your ISP provides real Usenet access (check their support
    pages), you'd be *far* better off using that.

    sherm--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
    Sherm Pendley, Jan 14, 2005
    #12
    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:
    930
    Jas Shultz
    Dec 3, 2003
  2. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    2,845
    Bryan Bullard
    Jul 11, 2003
  3. Christian Seberino
    Replies:
    21
    Views:
    1,599
    Stephen Horne
    Oct 27, 2003
  4. Ian Bicking
    Replies:
    2
    Views:
    964
    Steve Lamb
    Oct 23, 2003
  5. Ian Bicking
    Replies:
    2
    Views:
    690
    Michael Hudson
    Oct 24, 2003
Loading...

Share This Page