commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregor Zeitlinger" <gre...@zeitlinger.de>
Subject [io] FileSystemUtils.getDrives?
Date Sun, 29 Oct 2006 12:54:03 GMT
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?

-- 
Gregor Zeitlinger
gregor@zeitlinger.de

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message