Here you can find the source of makeDirectory(String directoryPath)
Parameter | Description |
---|---|
directoryPath | : This parametrs contains the full path of the directory. |
public static boolean makeDirectory(String directoryPath)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { /**// w w w. jav a 2 s .c o m * Makes a directory in the given path. * * @param directoryPath * : This parametrs contains the full path of the directory. * @return true if the operation is successed. */ public static boolean makeDirectory(String directoryPath) { File theDir = new File(directoryPath); boolean result = false; if (theDir.exists()) { try { theDir.delete(); // System.out.println("The old directory deleted."); theDir.mkdir(); result = true; } catch (SecurityException se) { System.err.println("Some problems happened while creating directory for extracting docx file."); return false; } } // if the directory does not exist, create it if (!theDir.exists()) { try { theDir.mkdir(); result = true; } catch (SecurityException se) { System.err.println("Some problems happened while creating directory for extracting docx file."); return false; } } return result; } }