public static void print(File f)throws IOException { if(f.isDirectory()) { File[] files = f.listFiles(); for(int i = 0; i < files.length; i ++) { if(files[i].isDirectory()) { print(files[i]); System.out.println(files[i]); } else { System.out.println(files[i].getName()); } } } }