Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the hard disk information using Perl

Tags:

windows

perl

I want to use the perl to check the hard disk space on Windows, is there any way to do it?

Best Regards,

like image 406
Yongwei Xing Avatar asked Aug 19 '10 07:08

Yongwei Xing


3 Answers

Most of the time, a portable solutions such as Filesys::DfPortable is the better choice. Recognise the opportunity to be virtuously lazy.

like image 63
daxim Avatar answered Sep 28 '22 16:09

daxim


see Win32::DriveInfo

($SectorsPerCluster, $BytesPerSector, $NumberOfFreeClusters, 
$TotalNumberOfClusters, $FreeBytesAvailableToCaller, $TotalNumberOfBytes, $TotalNumberOfFreeBytes) =  Win32::DriveInfo::DriveSpace( drive );

   $SectorsPerCluster          - number of sectors per cluster.
   $BytesPerSector             - number of bytes per sector.
   $NumberOfFreeClusters       - total number of free clusters on the disk.
   $TotalNumberOfClusters      - total number of clusters on the disk.
   $FreeBytesAvailableToCaller - total number of free bytes on the disk that
                                 are available to the user associated with the
                                 calling thread, b.
   $TotalNumberOfBytes         - total number of bytes on the disk, b.
   $TotalNumberOfFreeBytes     - total number of free bytes on the disk, b.
like image 30
Nikhil Jain Avatar answered Sep 28 '22 15:09

Nikhil Jain


Win32 Drive Info should do the trick.
I guess your are looking for

$TotalNumberOfFreeBytes

like image 38
weismat Avatar answered Sep 28 '22 15:09

weismat