- public static void printFile(File src,int lev) throws IOException {
- File[] files = src.listFiles();
- for (File file : files) {
- for(int i=0;i<lev;i++){
- System.out.print("\t");
- }
-
- System.out.println(file.getName());
- if(file.isDirectory()){
- printFile(file,lev+1);
-
- }
- }
- }
复制代码
|
|