Read File operations - create, copy, move, rename, delete, exist?, append, hide/unHide, creation/lastModified/lastAccessed date, compare, size, Read only and writable >
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:\ 
*/ 
 | 
RELATED LINKS>
Create File using createNewFile() method in java file IO
Execute CMD command through java program >
Execute CMD commands through java program
Labels:
Core Java
File IO/File handling