Java Create Directory mkdirs(String dirName)

Here you can find the source of mkdirs(String dirName)

Description

mkdirs

License

Open Source License

Declaration

public static synchronized boolean mkdirs(String dirName) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License"); you may

import java.io.File;

public class Main {
    public static synchronized boolean mkdirs(String dirName) {
        ///*from w  ww.j  a  v  a2  s .  co m*/
        // NOTE: This method needs to be synchronized due to issues
        // with the IBM and Sun JVMs. From the Sun website:
        // "File.mkdirs fails to create the entire hierarchy of
        // directories if another application or thread creates
        // one of the intervening directories while mkdirs is
        // running."
        //
        // Synchronizing here will at least protect the app
        // from clobbering itself. There is not much that can
        // be done to protect from an external process creating
        // colliding directory names.
        //

        File dirPath = new File(dirName);
        return dirPath.exists() || dirPath.mkdirs();
    }
}

Related

  1. mkdirs(final File outdir, final String path)
  2. mkdirs(final String path)
  3. mkdirs(final String path)
  4. mkdirs(String destDir)
  5. mkdirs(String destination)
  6. mkdirs(String fileName, String baseName)
  7. mkdirs(String filePath)
  8. mkdirs(String filePath)
  9. mkDirs(String filePath)