今天要用到,很简单的写了下 /** * Create new path and folder * @param pathOld String * @param pathNew String */ public static String MAKE_DIR(String pathOld, String pathNew) { try { if (! (new File(pathOld).isDirectory())) { new File(pathOld); new File(pathOld + "\\" + pathNew).mkdirs(); } else { new File(pathOld + "\\" + pathNew).mkdirs(); } } catch (SecurityException e) { System.out.println("can not create directory"); } return pathOld+pathNew+"//"; }

评论