"I don't think there is a way to determine free disk space in a
platform-independant way. For each platform there exist a simple way to
determine free disk space - but there is no api function in java
available to do this.
A simple method or two for determining free disk space will be added to
the java.io.File class in Mustang, which is scheduled to ship in
mid-2006.
The only way to find free disk space appears to be by a 'guess'
algorithm that attempts to create different file sizes...not
acceptable."

Signature
Fahd Shariff
ninhoa@yahoo.es - 21 Mar 2005 12:19 GMT
Try this, call it by a loop with File.listRoots() or something
similar.
NOTE: this method is slooooooooooow.
public long getFileSize(File fileOrDir, boolean includeSubDirs)
{
try
{
File f = fileOrDir;
long theSize = 0L;
int iDirs = 0;
int iDocs = 0;
File[] theFiles = f.listFiles(), dirs = new
File[theFiles.length], docs = new File[theFiles.length];
for ( int i=0; i<theFiles.length; i++ )
{
if ( theFiles[i].isDirectory() )
dirs[iDirs++] = theFiles[i];
else if ( theFiles[i].isFile() )
docs[iDocs++] = theFiles[i];
}
for ( int i=0; i<iDocs; i++ )
{
theSize += docs[i].length();
}
for ( int i=0; i<iDirs; i++ )
{
if (includeSubDirs)
getFileSize(dirs[i], includeSubDirs);
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
return theSize;
}