List root directory : File Commands « File Input Output « Java
- Java
- File Input Output
- File Commands
List root directory

import java.io.File;
public class ListRoots {
public static void main(String argh_my_aching_fingers[]) {
File[] drives = File.listRoots(); // Get list of names
for (int i = 0; i < drives.length; i++)
System.out.println(drives[i]); // Print the list
}
}
Related examples in the same category