Java Directory Create mkdirs(File file)

Here you can find the source of mkdirs(File file)

Description

Create all directories, including nonexistent parent directories.

License

Apache License

Declaration

public static boolean mkdirs(File file) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.File;

public class Main {
    /**/*from   w w  w .ja v a 2s .c  o m*/
     * Create all directories, including nonexistent parent directories.
     */
    public static boolean mkdirs(File file) {
        if (file != null) {
            String parent = file.getParent();
            if (parent != null) {
                File parentDir = new File(parent);
                if (!parentDir.exists()) {
                    return parentDir.mkdirs();
                }
            }
            return true;
        }

        return false;
    }
}

Related

  1. mkdirs(File f)
  2. mkDirs(File f)
  3. mkdirs(File f)
  4. mkdirs(File f)
  5. mkdirs(File file)
  6. mkdirs(File file)
  7. mkdirs(File file)
  8. mkdirs(File file)
  9. mkdirs(File file)