'FileSystems.getDefault()' method return default
FileSystem.
package com.sample.app; import java.nio.file.FileSystem; import java.nio.file.FileSystems; import java.nio.file.Path; public class App { public static void main(String args[]) { FileSystem fileSystem = FileSystems.getDefault(); Iterable<Path> paths = fileSystem.getRootDirectories(); for (Path path : paths) { System.out.println(path); } } }
If you are using windows file system with root
directories C:, D:, E:, F: then this getRootDirectories method return all these
4 directories.
No comments:
Post a Comment