Java Reference
In-Depth Information
System.out.println("Read-only file system: " + fs.isReadOnly());
System.out.println("File name separator: " + fs.getSeparator());
System.out.println("\nAvailable file-stores are");
for(FileStore store : fs.getFileStores()) {
printDetails(store);
}
System.out.println("\nAvailable root directories are");
for(Path root : fs.getRootDirectories()) {
System.out.println(root);
}
}
public static void printDetails(FileStore store) {
try {
String desc = store.toString();
String type = store.type();
long totalSpace = store.getTotalSpace();
long unallocatedSpace = store.getUnallocatedSpace();
long availableSpace = store.getUsableSpace();
System.out.println(desc + ", Total: " + totalSpace +
", Unallocated: " + unallocatedSpace +
", Available: " + availableSpace);
}
catch (IOException e) {
e.printStackTrace();
}
}
}
Read-only file system: false
File name separator: \
Available file-stores are
Local Disk (C:), Total: 1000097181696, Unallocated: 924354596864, Available: 924354596864
DataE (F:), Total: 1759213608960, Unallocated: 365291376640, Available: 365291376640
DataE (H:), Total: 1759213608960, Unallocated: 365291376640, Available: 365291376640
Available root directories are
C:\
D:\
E:\
F:\
H:\
Search WWH ::




Custom Search