Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get free space?

Status
Not open for further replies.

TonyGroves

Programmer
Aug 13, 2003
2,389
IE
Does anybody of a Perl function that returns the amount of free space on a filesystem?

I know I could use a system command like "df" and parse the output, but that's awkward, OS-dependent, and possibly version-dependent.
 
In the past I've had to write a module that looks at what OS it's running on, looks at what version it's on - and then interprets the output of some command or other. Not pretty in the module but at least in your script you can say something like $space_avail = freespace($fs)

Mike

I am not inscrutable. [orientalbow]

Want great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Have you checked CPAN for modules that will offer this facility and abstraction for portability?


Trojan.
 
MikeLacey:
Thanks, I suspected I would have to write my own function.

TrojanWarBlade:
There is Filesys::DiskFree, but apparently it's for Unixish systems only.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top