How to check size of harddisk?

J

Jason Quek

Hi

How can I use Perl to check the size of the harddisk and the amount of
space left?

Any help would be appreciated.

Regards,




Jason Q.
 
T

Tad McClellan

Jason Quek said:
How can I use Perl to check the size of the harddisk and the amount of
space left?

Any help would be appreciated.


Managing the filesystem is the job of the Operating System,
not of a programming language.

How would you check the size of a harddisk without using Perl?

You can likely do it whatever way that is from within Perl too,
but we don't even know what OS you need this for...
 
J

Jason Quek

Tad McClellan said:
Managing the filesystem is the job of the Operating System,
not of a programming language.

How would you check the size of a harddisk without using Perl?

You can likely do it whatever way that is from within Perl too,
but we don't even know what OS you need this for...

Hi Tad

The OS is Windows XP Pro. I have an indexing script, which, after it
is run, needs to report on how much space is left on the harddisk.

Thank you.




Jason Q.
 
S

Sherm Pendley

Jason said:
The OS is Windows XP Pro. I have an indexing script, which, after it
is run, needs to report on how much space is left on the harddisk.

Well, like Tad said - how would you do it without Perl? I.e. what
command would you run in a DOS box to get that information?

Once you find that out, the rest is simple - just use backticks or
open() to run that command and grab its output.

sherm--
 
S

Sisyphus

Jason Quek wrote:
d
The OS is Windows XP Pro. I have an indexing script, which, after it
is run, needs to report on how much space is left on the harddisk.

You can use Win32::AdminMisc for this.
my($total_drive_space, $available_space_on_this_drive) =
Win32::AdminMisc::GetDriveSpace($drive);

Cheers,
Rob
 
T

Thomas Kratz

Jason said:
Hi

How can I use Perl to check the size of the harddisk and the amount of
space left?

Any help would be appreciated.

Regards,




Jason Q.

Look at this sub I posted a few weeks ago to get the info from WMI

http://www.google.de/groups?hl=de&lr=&ie=UTF-8&[email protected]

Thomas

--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
 
J

Jason Quek

Sisyphus said:
Jason Quek wrote:
d

You can use Win32::AdminMisc for this.
my($total_drive_space, $available_space_on_this_drive) =
Win32::AdminMisc::GetDriveSpace($drive);

Cheers,
Rob

Hi Rob

Where can I find "Win32::AdminMisc"?

I have looked in the standard distribution and CPAN but cannot seem to
find this moduile.

Regards,




Jason Q.
 
S

Sisyphus

Jason said:
Hi Rob

Where can I find "Win32::AdminMisc"?

I have looked in the standard distribution and CPAN but cannot seem to
find this moduile.

Regards,




Jason Q.

Oh, yeah - it's one of Dave Roth's modules:
http://www.roth.net/perl/packages/

There are ppm's for both 5.6 and 5.8 on his site ... I hope you can find
the one you need :)

Cheers,
Rob
 
J

Joe Smith

Jason said:
How can I use Perl to check the size of the harddisk and the amount of
space left?

If the OS is Linux, Solaris or SunOS, you could use this:
http://www.inwap.com/mybin/miscunix/?disk-parts

linux# ./disk-parts
partition Megs start cyls use mountpoint
--------- ------ ----- ----- --- ----------
hda1 101 1 13 30% /boot
hda2 20,002 14 2550 56% /
hda3 509 2564 65 - Linux swap
hda4 132,010 2629 16829 - Win95 Ext'd (LBA)
hda5 132,010 2629 16829 19% /home
hdd1 238,472 1 30401 - Linux raid autodetect
md0 234,729 --- --- 23% /bkup

solaris# ./disk-parts
partition Megs start cyls use mountpoint
--------- ------ ----- ----- --- ----------
c0t1d0s2 8,759 0 14340 83% /export/bkup
c0t3d0s0 2,000 0 2560 81% /
c0t3d0s7 6,233 3216 7979 80% /export/home
 
T

Thomas Kratz

Jason said:
Hi Thomas

When I run this subroutine, I get this error:

Undefined subroutine &main::in called at script.cgi line 19

More specifically, the error occurs on this line:

my @inst = in($wmi->InstancesOf('Win32_ComputerSystem'));

Am I doing something wrongly?

You have to load Win32::OLE with

use Win32::OLE qw/in/;

Please read the docs for Win32::OLE for further informations ( in() is
documented in the section "Overloading")

Thomas

--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
 

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,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top