Are core modules permissible?
File::Find can be used to traverse a portion of a filesystem and tally things up. It's a rather inefficient solution if you want an entire volume's usage. The utilitydf would be better for information on an entire volume, and can be wrapped in a Perl call. And if you need to tally usage of a portion of a volume du would be useful. But if du and df are off the table, File::Find along with stat are good starting points.
The File::Find module has been bundled with Perl since Perl 5 began. If it is not allowed as part of the solution, then push back on that requirement, because the same logic would also prevent using strict and warnings.
Dave
In reply to Re: Get disk usage without modules
by davido
in thread Get disk usage without modules
by borodache
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |