Code Comments
Programming Forum and web based access to our favorite programming groups.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.
Post Follow-up to this messageOn 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.
Post Follow-up to this messageFrom: <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
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.