ccarden has asked for the wisdom of the Perl Monks concerning the following question:
I want to determine if there is enough room on a volume to write a file, so I need to know not how much space is currently used on the disk, but how much space is left. The examples that come closest to this requirement still use a system call.
The biggest problem with system calls is that you restrict yourself to a single platform. I need this script to run on both Linux and Windows. I also don't want to use very many modules, because often our customers do not allow extra modules to be loaded on their systems (think very large companies with very tight security and concern for software support -- and perhaps a prohibitively inefficient IT group).
My question, then, is, "How do I calculate total blocks on a volume?" I figure that I can use File::Find and lstat to get the blocks used, subtract that value from total blocks, and get blocks available. Perhaps another question should be, "Am I missing an easy way to determine total blocks available?"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl-only Disk Size/Usage
by Abigail-II (Bishop) on Mar 30, 2004 at 13:58 UTC | |
|
Re: Perl-only Disk Size/Usage
by matija (Priest) on Mar 30, 2004 at 13:53 UTC | |
|
Re: Perl-only Disk Size/Usage
by ctilmes (Vicar) on Mar 30, 2004 at 13:49 UTC | |
|
Re: Perl-only Disk Size/Usage
by b10m (Vicar) on Mar 30, 2004 at 13:50 UTC |