Java Utililty Methods Create Directory

List of utility methods to do Create Directory

  1. HOME
  2. Java
  3. C
  4. Create Directory

Description

The list of methods to do Create Directory are organized into topic(s).

Method

boolean mkdir(final File file)
mkdir
boolean mkdir = file.mkdir();
handle(mkdir, file);
return mkdir;
boolean mkdir(final String directory)
Creates a directory
File dir = new File(directory);
if (!dir.exists()) {
 return dir.mkdirs();
} else {
 System.out.println("Directory " + directory + " already exists");
return false;
void mkDir(final String folderPath)
Check if a folder path exists in the file system If not, create it
final File file = new File(folderPath);
if (!file.exists()) {
 file.mkdirs();
void mkDir(String destDir, String dirName)
mk Dir
File target = new File(destDir + PATH_CHAR + dirName);
if (!target.exists()) {
 if (!target.mkdir())
 throw new RuntimeException("The Directory can't create:" + target.getPath());
boolean mkdir(String dir)
Create a directory, if it does not exist.
if (!exists(dir)) {
 return (new File(dir)).mkdirs();
} else {
 return isDirectory(dir);
File mkdir(String dir, String file)
mkdir
if (dir == null)
 throw new IllegalArgumentException("dir must be not null");
File result = new File(dir, file);
parnetMkdir(result);
return result;
boolean mkdir(String dir_str)
A simple method that creates a directory if it does not exists.
File dir = new File(dir_str);
if (!dir.exists()) {
 try {
 dir.mkdir();
 return true;
 } catch (SecurityException se) {
 se.printStackTrace();
 return false;
...
void mkdir(String directory)
Creates a new directory if needed (no exists previously)
File f = new File(directory);
if (!f.exists()) {
 f.mkdir();
boolean mkdir(String directory)
mkdir
if (!(new File(directory)).exists())
 return (new File(directory)).mkdir();
return true;
void mkdir(String directory)
This method creates the specified directory.
File f = new File(directory);
if (f.exists()) {
 if (f.isFile()) {
 throw new IOException("Error creating directory:" + directory); 
} else {
 if (!f.mkdirs()) {
 throw new IOException("Error creating directory:" + directory); 
...


AltStyle によって変換されたページ (->オリジナル) /