On 10/29/06, Gregor Zeitlinger <[EMAIL PROTECTED]> wrote:
I recently had the problem to find the partition with the most free
space available.
FileSystemUtils.freeSpace was not working in that case, because I
wanted to check all available drives/mount points.
I solved this problem by using df on Linux and WMI (windows management
instrumentation) on Windows.
It would have been easier in the following form:

for(Drive d : FileSystemUtils.getDrives()) {
  if (d.freeSpace() > maxSpace) {
    result = d;
    maxSpace = d.freeSpace();
  }
}

Would you be interested in something like that?

What about File.listRoots() ?

 for(Drive d : File.listRoots()) {
   if (d.freeSpace() > maxSpace) {
     result = d;
     maxSpace = d.freeSpace();
   }
 }

Niall

Gregor Zeitlinger
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to