Create all parent folders if they do not exist.
515303
def makedirs(self):
        
        normpath = os.path.normpath(self.path)
        parentfolder = os.path.dirname(normpath)
        if parentfolder:
            try:
                os.makedirs(parentfolder)
            except OSError:
                pass
307769
def select_from(self, parent_path):
        """"""
        path_cls = type(parent_path)
        is_dir = path_cls.is_dir
        exists = path_cls.exists
        scandir = parent_path._accessor.scandir
        if not is_dir(parent_path):
            return iter([])
        return self._select_from(parent_path, is_dir, exists, scandir)
299974
function (parent) {
	var elems = fs.readdirSync( parent ),
		d = {
			files : [],
			folders : []
		};

	// get files and folders paths
	elems.forEach( function (elem) {
		var el = parent + '/' + elem;
		if (!isDir( el )) {
			d.files.push( el );
		} else if (!fs.existsSync( el + '.json')) {
			// add folder only if has no namesake json
			d.folders.push( el );
		}
	});

	return d;
}
1097098
def fill(self, paths):
        
        for path in paths:
            tree = self.tree
            parts = tuple(path.split('/'))
            dir_parts = parts[:-1]
            built = ()
            for part in dir_parts:
                self.cache[built] = tree
                built += (part, )
                parent = tree
                tree = parent.folders.get(part, empty)
                if tree is empty:
                    tree = parent.folders[part] = TreeItem(name=built, folders={}, files=set(), parent=parent)

            self.cache[dir_parts] = tree
            tree.files.add(parts[-1])
1150533
def makedirs(self, path, mode=0x777):
        ""
        self.directory_create(path, mode, [library.DirectoryCreateFlag.parents])
1263652
def make_local_directories(self):
        
        for remote_path in self._get_parent_remote_paths():
            local_path = os.path.join(self.dest_directory, remote_path)
            self._assure_dir_exists(local_path)
925767
private void createParents(String path, List<ACL> acl)
    throws InterruptedException, KeeperException

  {
    path = PathUtils.getParentPath(adjustPath(path));
    path = PathUtils.removeTrailingSlash(path);

    List<String> paths = new ArrayList<String>();

    while(!path.equals("") && getZk().exists(path, false) == null)
    {
      paths.add(path);

      path = PathUtils.getParentPath(path);
      path = PathUtils.removeTrailingSlash(path);
    }

    Collections.reverse(paths);

    for(String p : paths)
    {
      try
      {
        getZk().create(p,
                       null,
                       acl,
                       CreateMode.PERSISTENT);
      }
      catch(KeeperException.NodeExistsException e)
      {
        // ok we continue...
        if(log.isDebugEnabled())
          log.debug("parent already exists " + p);
      }
    }
  }
463099
protected boolean checkParentDirs(String path, boolean create_if_absent) throws IOException {
        String[] components=Util.components(path, File.separator);
        if(components == null)
            return false;
        if(components.length == 1) // no parent directories to create, e.g. "data.txt"
            return true;

        StringBuilder sb=new StringBuilder();
        boolean first=true;

        for(int i=0; i < components.length-1; i++) {
            String tmp=components[i];
            if(!tmp.equals(File.separator)) {
                if(first)
                    first=false;
                else
                    sb.append(File.separator);
            }
            sb.append(tmp);
            String comp=sb.toString();
            if(exists(comp)) {
                if(isFile(comp))
                    throw new IOException("cannot create " + path + " as component " + comp + " is a file");
            }
            else {
                if(create_if_absent)
                    cache.put(comp, new Metadata(0, System.currentTimeMillis(), chunk_size, Metadata.DIR), (short)-1, 0);
                else
                    return false;
            }
        }
        return true;
    }
448540
def makedirs(d):
    """"""
    if sys.version_info[0] < 3:
        from distutils.dir_util import mkpath
        mkpath(d)
    else:
        os.makedirs(d, exist_ok=True)
1230217
def mkdir(self, path, parents=True, raise_if_exists=False):
        
        try:
            self.call_check(load_hadoop_cmd() + ['fs', '-mkdir', path])
        except hdfs_error.HDFSCliError as ex:
            if "File exists" in ex.stderr:
                if raise_if_exists:
                    raise FileAlreadyExists(ex.stderr)
            else:
                raise
127784
protected boolean checkParentDirs(String path, boolean createIfAbsent) throws IOException {
      String[] components = Util.components(path, SEPARATOR);
      if (components == null)
         return false;
      if (components.length == 1) // no parent directories to create, e.g. "data.txt"
         return true;

      StringBuilder sb = new StringBuilder();
      boolean first = true;

      for (int i = 0; i < components.length - 1; i++) {
         String tmp = components[i];
         if (!tmp.equals(SEPARATOR)) {
            if (first)
               first = false;
            else
               sb.append(SEPARATOR);
         }
         sb.append(tmp);
         String comp = sb.toString();
         if (comp.equals(SEPARATOR))
            continue;
         Metadata val = exists(comp);
         if (val != null) {
            if (val.isFile())
               throw new IOException(format("cannot create %s as component %s is a file", path, comp));
         } else if (createIfAbsent) {
            metadataCache.put(comp, new Metadata(0, System.currentTimeMillis(), chunkSize, Metadata.DIR));
         } else {
            // Couldn't find a component and we're not allowed to create components!
            return false;
         }

      }
      // check that we have found all the components we need.
      return true;
   }
1038163
def replace_folder(path):
    """"""
    if os.path.exists(path):
        shutil.rmtree(path)
        os.makedirs(path)
    else:
        os.makedirs(path)
394746
def make_parent_dirs(path, mode=0o777):
  
  parent = os.path.dirname(path)
  if parent:
    make_all_dirs(parent, mode)
  return path
447007
def check_create_folder(filename):
    """"""
    os.makedirs(os.path.dirname(filename), exist_ok=True)
357659
def setup_directories(base_dir, subdirs):
  """"""
  base_dir = os.path.expanduser(base_dir)
  tf.gfile.MakeDirs(base_dir)

  all_dirs = {}
  for subdir in subdirs:
    if isinstance(subdir, six.string_types):
      subdir_tuple = (subdir,)
    else:
      subdir_tuple = subdir
    dir_name = os.path.join(base_dir, *subdir_tuple)
    tf.gfile.MakeDirs(dir_name)
    all_dirs[subdir] = dir_name
  return all_dirs
535084
def ensure_dirs(filename):
    """"""
    dirname = os.path.dirname(filename)
    if dirname and not os.path.exists(dirname):
        os.makedirs(dirname)
609784
public function createFolder($folder, $allFolders = FALSE)
    {
        if (substr($folder, -1) != '/') $folder = $folder . '/';
        if (!is_dir($folder)) {
            @mkdir($folder, 0777, $allFolders) or die ("Error creating folder '{$folder}'.");
        }
    }