commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregor Zeitlinger" <>
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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message