Disk free space is almost inherently system dependant.
Your File::Find method will fail because
- It doesn't take into account the "slack" caused by file sizes not being a integer multiples of cluster size.
- On unix operating systems, generaly between 5-10% of the disk is reserved and can only be written by root: disk appears smaller to normal users than to root.
- The user may have a system-mandated quota - calculating the size of free space on disk will not tell you how much a given user is allowed to write.
IMHO, your best option would be to use
df and
quota to calculate disk space on unix machines, and something else to calculate space on windows.
If all else fails, you can have a simple script that tries to write a file of desired size, and deletes it immediately
afterwads - that will give you the definitive, system-independent answer. All you have to do is trap the error, and if you receive it, the file is too large.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.