importjava.io.File;
importjavax.swing.filechooser.FileSystemView;
public class DrivesLists {
public static voidmain(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