Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

[Free Disk Space] : in Windows using perl
Hi,

Is there anyway to find out "Free Disk Space" in Windows using PERL?
Assume I have a function say GetFreeDiskSpace(). I can specify some path
as a parameter to GetFreeDiskSpace() and want to get the return value in
bytes for available disk. The path can contain "Local Drive Name" or
"Share Name" or "Shared IP Address".

Further enhancement to this can be, I pass second parameter to it for
specifying the how the return value should be i.e. "Bytes" or "Kilo
Bytes" or "Mega Bytes" etc.

Regards
~Suresh



Confidentiality Notice

The information contained in this electronic message and any attachments tot
his message are intended
for the exclusive use of the addressee(s) and may contain confidential orpri
vileged information. If
you are not the intended recipient, please notify the sender at Wipro orMail
admin@wipro.com immediately
and destroy all copies of this message and any attachments.

Report this thread to moderator Post Follow-up to this message
Old Post
Suresh Pasupula
04-22-04 09:33 PM


Re: [Free Disk Space] : in Windows using perl
On Apr 23, suresh.pasupula@wipro.com said:

>Is there anyway to find out "Free Disk Space" in Windows using PERL?
>Assume I have a function say GetFreeDiskSpace(). I can specify some path
>as a parameter to GetFreeDiskSpace() and want to get the return value in
>bytes for available disk. The path can contain "Local Drive Name" or
>"Share Name" or "Shared IP Address".

Download the Win32::DriveInfo module from CPAN (you can probably use ppm
to get it).

http://search.cpan.org/~mblaz/Win32-DriveInfo-0.06/
http://search.cpan.org/~mblaz/Win32...06/DriveInfo.pm

--
Jeff "japhy" Pinyan      japhy@pobox.com      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
CPAN ID: PINYAN    [Need a programmer?  If you like my work, let me know
.]
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


Report this thread to moderator Post Follow-up to this message
Old Post
Jeff 'Japhy' Pinyan
04-22-04 09:33 PM


Re: [Free Disk Space] : in Windows using perl
From: <suresh.pasupula@wipro.com>
> Is there anyway to find out "Free Disk Space" in Windows using PERL?
> Assume I have a function say GetFreeDiskSpace(). I can specify some
> path as a parameter to GetFreeDiskSpace() and want to get the return
> value in bytes for available disk. The path can contain "Local Drive
> Name" or "Share Name" or "Shared IP Address".

use Win32::FileOp qw(GetDiskFreeSpace);
# c:\> ppm install Win32::FileOp

my $freeSpaceOnC = GetDiskFreeSpace( 'c:');
my $freeSpaceOnShare = GetDiskFreeSpace( '\\\\server\share');
# these numbers would respect the user's quota!

If you want to get the total amout of (free) space you just use this
function in list context:

($freeSpaceForUser, $totalSize, $totalFreeSpace)
= GetDiskFreeSpace $path;


> Further enhancement to this can be, I pass second parameter to it for
> specifying the how the return value should be i.e. "Bytes" or "Kilo
> Bytes" or "Mega Bytes" etc.

Sorry you have to do this yourself. The function above tells you the
number of bytes.

HTH, Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


Report this thread to moderator Post Follow-up to this message
Old Post
Jenda Krynicky
04-22-04 11:33 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:11 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.