Program to Find the available filesystem roots in java/ Available disk drives in windows








Program to Find the available filesystem roots in java/ Available disk drives in windows >



import java.io.File;
/** JavaMadeSoEasy.com */
public class FindFileSystemRoots {
   public static void main(String[] args) {
          System.out.println("List of available filesystem roots - ");
          for(File file :File.listRoots()){
                 System.out.println(file);
          }
   }
}
/*OUTPUT
List of available filesystem roots -
C:\
D:\
E:\
*/


Read : Directory operations - create, identify, delete, copy, traverse >

RELATED LINKS>

Create File using createNewFile() method in java file IO


Execute CMD command through java program >

Execute CMD commands through java program


Must read for you :

No comments:

Post a Comment