How can I find the free space available on mounted volumes using Perl?

Ram picture Ram · Feb 11, 2009 · Viewed 10.3k times · Source

I'm trying to untar a file. Before untarring I would like to know free space available on the mounted volume. The plan is if there is not enough space I will not untar it! So how can I find the free space available on a mounted volume using Perl? By the way, I'm using Perl for tar and untar.

Everybody is saying about df and dh but these commands doesn't work on the mount points. What if I want to find the free space that I can write into on a mounted point?

Answer

chaos picture chaos · Feb 11, 2009

You likely want the CPAN module Filesys::DfPortable.