public class Hello{ public static void main(String args[]) throws Exception{ File file = new File("E:" + File.separator); list(file); } public static void list(File file){ if(file.isDirectory()){ File result[] = file.listFiles(); if(result != null){ for(int i=0; i<result.length; i++){ list(result[i]); } } } System.out.println(file); } }
时间: 2024-10-20 22:19:59