Creates a directory recursively
@param  string $strPath path
@param  integer $rights right for new directory
@throws \RuntimeException
513474
public static function createDir($strPath, $rights = 0777)
    {
        $folderPath = array($strPath);
        $oldumask = umask(0);

        while (!@is_dir(dirname(end($folderPath)))
            && dirname(end($folderPath)) != "/"
            && dirname(end($folderPath)) != "."
            && dirname(end($folderPath)) != ""
        ) {
            array_push($folderPath, dirname(end($folderPath)));
        }

        while ($parentFolderPath = array_pop($folderPath)) {
            if (!@is_dir($parentFolderPath)) {
                if (!@mkdir($parentFolderPath, $rights)) {
                    throw new \RuntimeException("Runtime Error: Can't create folder: $parentFolderPath");
                }
            }
        }

        umask($oldumask);
    }
1362012
private static function createIndexFilesToPreventDirectoryListing($path)
    {
        if (!self::isPathWithinTmpFolder($path)) {
            return;
        }
        $filesToCreate = array(
            $path . '/index.htm',
            $path . '/index.php'
        );
        foreach ($filesToCreate as $file) {
            @file_put_contents($file, 'Nothing to see here.');
        }
    }
310185
private static void mkDirs(ChannelSftp channelSftp, String path) {
//		System.err.println("### CREATE SFTP-PATH: " + path);
		int lastSepPos = path.lastIndexOf('/');
		if (lastSepPos > 0) {
			String parentPath = path.substring(0, lastSepPos);
			mkDirs(channelSftp, parentPath);
		}
		try {
			channelSftp.mkdir(path);
		} catch(SftpException e) {
//			System.err.println("### FAILD TO CREATE PATH FOR: " + path + ", ERROR: " + e.getMessage());			
		}
	}
456401
private function createRecursive($path)
    {
        $treeWalker = $this->getTreeWalker();
        $name = basename($path);
        $parentPath = dirname($path);
        if (!($parentTree = $treeWalker->walk($parentPath))) {
            $parentTree = $this->createRecursive($parentPath);
        }

        return $this->treeManager->createTree($name, $parentTree);
    }
1290955
protected function createEmbeddedPath()
    {
        $path = upload_path('embedded');

        if ( ! file_exists($path))
        {
            if ( ! mkdir($path, 0777, true))
            {
                throw new RuntimeException('Directory (' . $path . ') could not be created.');
            }
        }
    }
754654
public void makeDirectory(String path) throws SftpStatusException,
			SshException {
		makeDirectory(path, new SftpFileAttributes(this,
				SftpFileAttributes.SSH_FILEXFER_TYPE_DIRECTORY));
	}
427055
public function mkdir($path)
    {
        $info = $this->info($path);
        if ($info->isDir()) {
            return $this;
        }

        if (!mkdir($info->getStreamUrl(), $this->dirMode, true)) {
            throw new RuntimeException(sprintf(
                'Failed to create directory "%s": %s',
                $path, $this->getLastPhpError()
            ));
        }

        return $this;
    }
809848
public function createFile($path, $contents)
    {
        $path = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $path);

        $this->_io->out();

        $fileExists = is_file($path);
        if ($fileExists && empty($this->params['force']) && !$this->interactive) {
            $this->_io->out('<warning>File exists, skipping</warning>.');

            return false;
        }

        if ($fileExists && $this->interactive && empty($this->params['force'])) {
            $this->_io->out(sprintf('<warning>File `%s` exists</warning>', $path));
            $key = $this->_io->askChoice('Do you want to overwrite?', ['y', 'n', 'a', 'q'], 'n');

            if (strtolower($key) === 'q') {
                $this->_io->out('<error>Quitting</error>.', 2);
                $this->_stop();

                return false;
            }
            if (strtolower($key) === 'a') {
                $this->params['force'] = true;
                $key = 'y';
            }
            if (strtolower($key) !== 'y') {
                $this->_io->out(sprintf('Skip `%s`', $path), 2);

                return false;
            }
        } else {
            $this->out(sprintf('Creating file %s', $path));
        }

        $File = new File($path, true);

        try {
            if ($File->exists() && $File->writable()) {
                $File->write($contents);
                $this->_io->out(sprintf('<success>Wrote</success> `%s`', $path));

                return true;
            }

            $this->_io->err(sprintf('<error>Could not write to `%s`</error>.', $path), 2);

            return false;
        } finally {
            $File->close();
        }
    }
198983
public static function createFromPath(string $path, $context = null): self
    {
        $file_args = [$path, false];
        $mime_args = [$path, FILEINFO_MIME];
        if (null !== $context) {
            $file_args[] = $context;
            $mime_args[] = $context;
        }

        $content = @file_get_contents(...$file_args);
        if (false === $content) {
            throw new SyntaxError(sprintf('`%s` failed to open stream: No such file or directory', $path));
        }

        return new self(
            str_replace(' ', '', (new finfo(FILEINFO_MIME))->file(...$mime_args))
            .';base64,'.base64_encode($content)
        );
    }
628838
public static function createFolder(String $file, Int $permission = 0755, Bool $recursive = true) : Bool
    {
        return Filesystem::createFolder(Info::rpath($file), $permission, $recursive);
    }
673671
public function makeDirectory($path)
    {
        event(new Events\DirectoryCreating($path));
        $created = $this->disk()->makeDirectory($path);
        event(new Events\DirectoryCreated($path, $created));

        return $created;
    }
219157
protected function setGeneratedFilePermissions($strFilePath)
    {
        // CHMOD to full read/write permissions (applicable only to nonwindows)
        // Need to ignore error handling for this call just in case
        if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
            $e = new Error\Handler();
            chmod($strFilePath, 0666);
        }
    }
470678
protected function createDirectory($paths)
    {
        if (!is_array($paths)) {
            $paths = array($paths);
        }

        foreach ($paths as $path) {
            if (!is_dir($dir = dirname($path)) && false === @mkdir($dir, 0777, true)) {
                // @codeCoverageIgnoreStart
                throw new \RuntimeException(sprintf('Unable to create directory "%s".', $dir));
                // @codeCoverageIgnoreEnd
            }
        }
    }
407320
public function put($path, $contents)
    {
        $directory = dirname($path);
        $this->createDir($directory);
        $path = $this->getPath($path);
        if (!file_exists($path) && !is_writable(dirname($path))) {
            throw new RuntimeException(dirname($path) . ' is not writable');
        }

        if (file_exists($path) && !is_writable($path)) {
            throw new RuntimeException($path . ' is not writable');
        }

        return file_put_contents($path, $contents);
    }
1183364
public static final Path create(Path path, String perms) throws IOException
    {
        return create(path, null, perms);
    }
766166
public function mkdir( $path )
	{
		try {
			$this->fs->makeDirectory( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
529676
public function createDir($path)
    {
        $directory = $this->getPath($path);
        if (!is_dir($directory)) {
            if (file_exists($directory)) {
                throw new RuntimeException(
                    $directory . ' is not a directory.'
                );
            }

            if (!mkdir($directory, 0777, true)) {
                throw new RuntimeException(
                    $directory . ' can not be created.'
                );
            }
        }

        return true;
    }