判断指定盘符下文件夹是否存在

判断指定盘符下文件夹是否存在

1.判断E:盘下MySQL文件夹是否存在。若不存在,则创建。

import java.io.File;

public class Test {
public static void main(String[] args) {
isExist("E:\\MySQL");
}

private static void isExist(String path) {
File file = new File(path);//判断文件夹是否存在,如果不存在则创建文件夹
if (!file.exists()) {
file.mkdir();
}
}

}

posted @ 2013-10-06 11:32  zhgs_cq  阅读(496)  评论(0编辑  收藏  举报