- import java.io.File;
- public class Test1 {
- public static void demo(File file){
- File[] f=file.listFiles();
- for(int x=0;x<file.length();x++){
- if(f[x].isDirectory()){
- demo(f[x]);
- }else{
- System.out.println(f[x]);
- }
-
- }
-
- }
- public static void main(String[] args) {
- File file=new File("d:\\Program Files\\Ludashi2");
- System.out.println(file.getName());
- demo(file);
- }
- }
复制代码 |
|