Java create folder

使用下面的範例, 建立目錄:

Path path = Paths.get("/tmp/your-folder/");
if (!Files.exists(path)) {
    Path directories;
	try {
		directories = Files.createDirectories(path);
        System.out.println("directories created: " + directories);
        System.out.println("dir created exits: " + Files.exists(directories));
	} catch (IOException e) {
		e.printStackTrace();
	}
}	

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *