java创建文件夹实例

package com.cn;

import java.io.File;

/**
 * 创建文件夹类
 * 创建者    :  xxx
 * 创建日期: 2018年06月29日
 * */

public class CreateFileDirectory {

       /**
 * 创建Files文件夹
 * 创建者    :  xxx
 * 创建日期: 2018年06月12日
 * 参数:
 *   path:需要在哪个路径下创建,path,指某个路径地址
 * @version: 1.0 
 */

    public static boolean mkDirectory(String pathFile) {  

            File file = null;  
            try {  
                file = new File(pathFile);  
                if (!file.exists()) {  
                    return file.mkdirs();  
                }else{  
                    return false;  
                }  
            } catch (Exception e) {  
            } finally {  
                file = null;  
            }  
            return false;  

     }  

}

猜你喜欢

转载自blog.csdn.net/li1325169021/article/details/80731659