Create directories optional.

@param dirPath the dir path
@param attrs   the attrs
@return the optional
966629
public static Optional<Path> createDirectories(Path dirPath,
            FileAttribute<?>... attrs) {
        debug(log, "createDirectories", dirPath, attrs);
        try {
            return Optional.of(Files.createDirectories(dirPath, attrs));
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnEmptyOptional(log,
                    e, "createDirectories", dirPath);
        }
    }
231337
def create_directory(self, path=None):
        
        if path is None:
            path = self.get_path()
        if not os.path.exists(path):
            os.makedirs(path)
642216
@Override
  public void createDirectory(Path dir, FileAttribute<?>... attrs) {
    CloudStorageUtil.checkPath(dir);
    CloudStorageUtil.checkNotNullArray(attrs);
  }
1293960
public static final Path create(Path path, Path target, String perms) throws IOException
    {
        FileAttribute<?>[] attrs = getFileAttributes(perms);
        switch (perms.charAt(0))
        {
            case '-':
                return Files.createFile(path, attrs);
            case 'l':
                if (target == null)
                {
                    throw new IllegalArgumentException("no target");
                }
                return Files.createSymbolicLink(path, target, attrs);
            case 'd':
                return Files.createDirectories(path, attrs);
            default:
                throw new IllegalArgumentException(perms+" illegal to this method");
        }
    }
149256
public static File createFolder(String path, String dest_dir)
            throws BeastException {
        File f = new File(dest_dir);
        if (!f.isDirectory()) {
            try {
                f.mkdirs();
            } catch (Exception e) {
                logger.severe("Problem creating directory: " + path
                        + File.separator + dest_dir);
            }
        }

        String folderPath = createFolderPath(path);

        f = new File(f, folderPath);
        if (!f.isDirectory()) {
            try {
                f.mkdirs();
            } catch (Exception e) {
                String message = "Problem creating directory: " + path
                        + File.separator + dest_dir;
                logger.severe(message);
                throw new BeastException(message, e);
            }
        }

        return f;
    }
1012184
public static File mkdir(String dirPath) {
		if (dirPath == null) {
			return null;
		}
		final File dir = file(dirPath);
		return mkdir(dir);
	}
182212
@Override
	public boolean isDirectory(String dirPath) {
		String path = dirPath.replace('/', File.separatorChar);
		return new File(baseDir, path).isDirectory();
	}
48767
def create_dir_unless_exists(*args):
    """"""
    path = os.path.join(*args)
    if not os.path.isdir(path):
        os.makedirs(path)
1040037
public void mkdirs(URI path) throws IOException {
    logger.atFine().log("mkdirs(%s)", path);
    Preconditions.checkNotNull(path);

    if (path.equals(GCS_ROOT)) {
      // GCS_ROOT directory always exists, no need to go through the rest of the method.
      return;
    }

    StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true);
    resourceId = FileInfo.convertToDirectoryPath(resourceId);

    // Create a list of all intermediate paths.
    // For example,
    // gs://foo/bar/zoo/ => (gs://foo/, gs://foo/bar/, gs://foo/bar/zoo/)
    //
    // We also need to find out if any of the subdir path item exists as a file
    // therefore, also create a list of file equivalent of each subdir path.
    // For example,
    // gs://foo/bar/zoo/ => (gs://foo/bar, gs://foo/bar/zoo)
    List<String> subdirs = getSubDirs(resourceId.getObjectName());
    List<StorageResourceId> itemIds = new ArrayList<>(subdirs.size() * 2 + 1);
    for (String subdir : subdirs) {
      itemIds.add(new StorageResourceId(resourceId.getBucketName(), subdir));
      if (!Strings.isNullOrEmpty(subdir)) {
        itemIds.add(
            new StorageResourceId(resourceId.getBucketName(), FileInfo.convertToFilePath(subdir)));
      }
    }
    // Add the bucket portion.
    itemIds.add(new StorageResourceId(resourceId.getBucketName()));
    logger.atFine().log("mkdirs: items: %s", itemIds);

    List<GoogleCloudStorageItemInfo> itemInfos = gcs.getItemInfos(itemIds);

    // Each intermediate path must satisfy one of the following conditions:
    // -- it does not exist or
    // -- if it exists, it is a directory
    //
    // If any of the intermediate paths violates these requirements then
    // bail out early so that we do not end up with partial set of
    // created sub-directories. It is possible that the status of intermediate
    // paths can change after we make this check therefore this is a
    // good faith effort and not a guarantee.
    GoogleCloudStorageItemInfo bucketInfo = null;
    List<StorageResourceId> subdirsToCreate = new ArrayList<>(subdirs.size());
    for (GoogleCloudStorageItemInfo info : itemInfos) {
      if (info.isBucket()) {
        checkState(bucketInfo == null, "bucketInfo should be null");
        bucketInfo = info;
      } else if (info.getResourceId().isDirectory() && !info.exists()) {
        subdirsToCreate.add(info.getResourceId());
      } else if (!info.getResourceId().isDirectory() && info.exists()) {
        throw new FileAlreadyExistsException(
            "Cannot create directories because of existing file: " + info.getResourceId());
      }
    }

    if (!checkNotNull(bucketInfo, "bucketInfo should not be null").exists()) {
      gcs.create(bucketInfo.getBucketName());
    }
    gcs.createEmptyObjects(subdirsToCreate);

    // Update parent directories, but not the ones we just created because we just created them.
    List<URI> createdDirectories =
        subdirsToCreate.stream()
            .map(s -> pathCodec.getPath(s.getBucketName(), s.getObjectName(), false))
            .collect(toImmutableList());
    tryUpdateTimestampsForParentDirectories(createdDirectories, createdDirectories);
  }
912987
public static <I> Projection<I, Object[]> multiAttribute(String... attributePaths) {
        return new MultiAttributeProjection<I>(attributePaths);
    }
346291
function createDirs(arrPaths) {
  arrPaths.forEach(path => {
    if (!fs.existsSync(path)) {
      fs.mkdirSync(path);
    }
  });
}
186576
def makedirs(path):
    
    if os.path.exists(path):
        if not os.path.isdir(path):
            # If it's not a directory, we can't do anything.
            # This is a problem
            raise RuntimeError('%s already exists and is not a directory.'
                               % path)
    else:
        os.makedirs(path)
249339
@Override
    public T addAsDirectories(final String... paths) throws IllegalArgumentException {
        // Precondition check
        Validate.notNull(paths, "paths must be specified");

        // Represent as array of Paths
        final Collection<ArchivePath> pathsCollection = new ArrayList<ArchivePath>(paths.length);
        for (final String path : paths) {
            pathsCollection.add(ArchivePaths.create(path));
        }

        // Delegate and return
        return this.addAsDirectories(pathsCollection.toArray(new ArchivePath[] {}));
    }
1110840
public static boolean isDirectory(Path path, boolean isFollowLinks) {
		if (null == path) {
			return false;
		}
		final LinkOption[] options = isFollowLinks ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS };
		return Files.isDirectory(path, options);
	}
1329686
public boolean isDirectory() throws SmbException {
        if( getUncPath0().length() == 1 ) {
            return true;
        }
        if (!exists()) return false;
        return ( attributes & ATTR_DIRECTORY ) == ATTR_DIRECTORY;
    }
226145
public static BasicFileAttributes getAttributes(Path path, boolean isFollowLinks) throws IORuntimeException {
		if (null == path) {
			return null;
		}

		final LinkOption[] options = isFollowLinks ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS };
		try {
			return Files.readAttributes(path, BasicFileAttributes.class, options);
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
758924
public JimfsPath createPath(@Nullable Name root, Iterable<Name> names) {
    ImmutableList<Name> nameList = ImmutableList.copyOf(Iterables.filter(names, NOT_EMPTY));
    if (root == null && nameList.isEmpty()) {
      // ensure the canonical empty path (one empty string name) is used rather than a path with
      // no root and no names
      return emptyPath();
    }
    return createPathInternal(root, nameList);
  }