首页 > 其他 > 详细

获取文件名称

时间:2020-02-29 03:01:16      阅读:37      评论:0      收藏:0      [点我收藏+]
    public static void main(String[] args) {
        // TODO Auto-generated method stub
         File f = new File("D://360压缩");
            mothod(f);
    }
    public static void mothod(File f){
        if (f.isFile() || !f.exists()){
            return;
        }
        File[] files = f.listFiles();
        for(File Fs : files){
            if (Fs.isFile()){
                System.out.println("文件:"+Fs.getName());
            }else{
                System.out.println("目录:"+Fs.getName());
                mothod(Fs);
            }

        }
    }

 

获取文件名称

原文:https://www.cnblogs.com/rzkwz/p/12381067.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!