Find out the directory
import java.io.File; import java.io.IOException; public class FindDirectories { public static void main(String[] args) { try { File pathName = new File("c:\\"); String[] fileNames = pathName.list(); for (int i = 0; i < fileNames.length; i++) { File tf = new File(pathName.getPath(), fileNames[i]); if (tf.isDirectory()) { System.out.println(tf.getCanonicalPath()); } } } catch (IOException e) { System.out.println("Error: " + e); } } }