public static void getAbsolutePath(File file) throws IOException {
File[] fileArr = file.listFiles();
if (fileArr != null) {
for (File f : fileArr) {
if (f.isDirectory()) {
getAbsolutePath(f);
} else if (f.getName().endsWith(".java")) {
String str = f.getAbsolutePath();
BufferedWriter bw = new BufferedWriter(new FileWriter(
"e:\\java_numbers.txt", true));
bw.write(str);
bw.newLine();
bw.flush();
bw.close();
System.out.println(str);
}
}
}
} |
|