Tuesday, April 19, 2011

Displaying root directories in the system using java

This can be done using static method File.listRoots().

Eg.
File[] roots = File.listRoots();
System.out.println("Root directories :");
for (int i=0; i < roots.length; i++) {
    System.out.println(roots[i].toString());
 }

No comments:

Post a Comment

Chitika