Java Create Directory mkdirsIfNotExists(String pathname)

Here you can find the source of mkdirsIfNotExists(String pathname)

Description

mkdirs If Not Exists

License

Open Source License

Declaration

public static boolean mkdirsIfNotExists(String pathname) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static boolean mkdirsIfNotExists(String pathname) {
        File file = new File(pathname);
        if (!file.isDirectory()) {
            if (!file.mkdirs()) {
                System.err.println("fail to create directory: " + pathname);
                return false;
            }// w w  w .j a  va  2  s  .  co m
        }
        return true;
    }
}

Related

  1. mkdirs(String path, boolean deleteBeforeCreate)
  2. mkdirs(String path, boolean override)
  3. mkdirs(String s)
  4. mkdirsFor(File destination)
  5. mkdirsIfAbsent(String pathname)
  6. mkdirsifnotExists(String s)
  7. mkdirsInRemote(String host, String path, boolean deleteIfExisted)
  8. mkdirsOrCrash(File d)
  9. mkdirsOrFail(File dirFile)