飞狐爷

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
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);
    }
}

 

posted on 2016-08-25 19:51  飞狐爷  阅读(205)  评论(0编辑  收藏  举报