disk space script

B

Bernd

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
 
J

jc8glp1hu

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
 
J

jc8glp1hu

Wow, google really butchers the text as you enter it! that system line
with the right arrow thing is supposed to be one line.
 
A

Anno Siegel

[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()
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
 
J

jc8glp1hu

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";
}
 
A

Anno Siegel

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
 
T

Tad McClellan

jc8glp1hu said:
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.
 
J

jc8glp1hu

Sorry

Tad said:
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.
 
P

Paul Lalli

jc8glp1hu said:
Sorry



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
 
A

Arndt Jonasson

jc8glp1hu said:
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.
 
S

Sherm Pendley

jc8glp1hu said:
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--
 

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

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top