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.