import
java.io.File;
import
javax.swing.filechooser.FileSystemView;
public class DrivesLists
{
public static void
main(String[] args) {
FileSystemView fsv = FileSystemView.getFileSystemView();
File[] drives = File.listRoots();
if (drives != null && drives.length > 0) {
for (File drive : drives) {
System.out.print("Drive name: "+drive);
System.out.print(",\tType: "+fsv.getSystemTypeDescription(drive));
System.out.print(",\tTotal space: "+drive.getTotalSpace());
System.out.print(",\tFree space: "+drive.getFreeSpace());
System.out.println();
}
}
}
}
No comments:
Post a Comment