Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; public class Main { public static boolean createDirIfNotExisted(String path, boolean isNomedia) { File file = new File(path); File fileName = new File(path + "/.nomedia"); try { if (!file.exists()) { file.mkdirs(); } if (isNomedia && !fileName.exists()) { fileName.createNewFile(); } } catch (IOException e) { e.printStackTrace(); } return true; } }