dcsimg

How do I list all drives/filesystem roots on my system?

Davanum Srinivas

The listRoots() method of the File class was introduced with the 1.2 release for this:

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