- public static void listFiles(String filePath, int level) {
- String pre = " ";
- File tempf;
- File f = new File(filePath);
- String[] fileList = f.list();
- for(int j=0; j<level; j++) {
- pre += pre;
- }
- level ++;
- for(int i=0; i<fileList.length; i++) {
- tempf = new File(filePath+"//"+fileList[i]);
- System.out.println(pre + tempf.getPath());
- if(tempf.isDirectory()) {
- listFiles(tempf.getAbsolutePath(), level);
- }
- }
- }