@param string $path Path to folder.

@return bool
14582
public static function isDir($path)
    {
        return (self::isPhar($path) === true) ? file_exists($path) : is_dir($path);
    }
168766
public function delete($path = null)
    {
        if (!$path) {
            $path = $this->pwd();
        }
        if (!$path) {
            return false;
        }
        $path = Folder::slashTerm($path);
        if (is_dir($path)) {
            try {
                $directory = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::CURRENT_AS_SELF);
                $iterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::CHILD_FIRST);
            } catch (Exception $e) {
                return false;
            }

            foreach ($iterator as $item) {
                $filePath = $item->getPathname();
                if ($item->isFile() || $item->isLink()) {
                    //@codingStandardsIgnoreStart
                    if (@unlink($filePath)) {
                        //@codingStandardsIgnoreEnd
                        $this->_messages[] = sprintf('%s removed', $filePath);
                    } else {
                        $this->_errors[] = sprintf('%s NOT removed', $filePath);
                    }
                } elseif ($item->isDir() && !$item->isDot()) {
                    //@codingStandardsIgnoreStart
                    if (@rmdir($filePath)) {
                        //@codingStandardsIgnoreEnd
                        $this->_messages[] = sprintf('%s removed', $filePath);
                    } else {
                        $this->_errors[] = sprintf('%s NOT removed', $filePath);

                        return false;
                    }
                }
            }

            $path = rtrim($path, DIRECTORY_SEPARATOR);
            //@codingStandardsIgnoreStart
            if (@rmdir($path)) {
                //@codingStandardsIgnoreEnd
                $this->_messages[] = sprintf('%s removed', $path);
            } else {
                $this->_errors[] = sprintf('%s NOT removed', $path);

                return false;
            }
        }

        return true;
    }
425595
public function check_path($path = '')
	{
		if ($path === '')
		{
			if ($this->db->cachedir === '')
			{
				return $this->db->cache_off();
			}

			$path = $this->db->cachedir;
		}

		// Add a trailing slash to the path if needed
		$path = realpath($path)
			? rtrim(realpath($path), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR
			: rtrim($path, '/').'/';

		if ( ! is_dir($path))
		{


			// If the path is wrong we'll turn off caching
			return $this->db->cache_off();
		}

		if ( ! is_really_writable($path))
		{

			// If the path is not really writable we'll turn off caching
			return $this->db->cache_off();
		}

		$this->db->cachedir = $path;
		return TRUE;
	}
155949
public function rmdir($path)
    {
        $path = $this->realpath($path) . '/';
        $length = strlen($path);
        foreach (array_keys($this->files) as $filename) {
            if (substr($filename, 0, $length) === $path) {
                return false;
            }
        }
        $this->at($path, null);
        return true;
    }
915699
public function createFolder($path)
    {
        $mode = 0777;
        $recursive = true;
        $path = ltrim($path, "/");
        return mkdir($this->pathRoot.$path, $mode, $recursive);
    }
1352613
public function delete($path)
    {
        $location = $this->applyPathPrefix($path);

        try {
            $this->share->del($location);
        } catch (NotFoundException $e) {
            return false;
        } catch (InvalidTypeException $e) {
            return false;
        }

        return true;
    }
398094
public function isAbsolutePath($path)
    {
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            if (preg_match('/^[A-Z]:\\\\/', $path)) {
                return true;
            }
        } else {
            if (substr($path, 0, 1) == DIRECTORY_SEPARATOR) {
                return true;
            }
        }

        return false;
    }
718992
public function cd($path)
    {
        $path = $this->realpath($path);
        if ($path !== false && is_dir($path)) {
            return $this->path = $path;
        }

        return false;
    }
1150335
public function makeDir($path)
    {
        if (empty($path)) return false;
        $dir = explode("/", $path);
        $path = ftp_pwd($this->linkid) . '/';
        $ret = true;
        for ($i=0; $i<count($dir); $i++) {
            $path = $path . $dir[$i] . '/';
            if (!@ftp_chdir($this->linkid, $path)) {
                if (!@ftp_mkdir($this->linkid, $dir[$i])) {
                    $ret = false;
                    break;
                }
            }
            @ftp_chdir($this->linkid, $path);
        } 
        if (!$ret) return false;
        return true;
    }
734447
public function deleteFolder($path)
    {
        $path = self::validatePath($path);
        $fullPaths = $this->getMediaPath($path);

        return $this->getStorageDisk()->deleteDirectory($fullPaths);
    }
369184
protected function checkPath($path)
    {
        foreach ($this->chroots as $chroot) {
            if (StringHelper::contains($path, $chroot)) {
                return true;
            }
        }
        return false;
    }
726439
public static function rmdir($path)
    {
        $files = array_diff(scandir($path), array('.', '..'));

        $filesystem = new Filesystem();

        foreach ($files as $file) {
            $file = $path . DIRECTORY_SEPARATOR . $file;

            if (!file_exists($file)) {
                continue;
            }

            try {
                $filesystem->remove($file);
            } catch (IOException $exception) {
                return false;
            }
        }

        return true;
    }
1179972
protected function makeDirectory($path)
    {
        if (!is_dir(dirname($path))) {
            mkdir(dirname($path), 0777, true);
        }

        return $path;
    }
460530
public function getFolder($path = '')
    {
        $this->connect();

        $path = trim(trim($path, '/'));

        if ($this->isRootPath($path))
        {
            $data            = [ ];
            $data['files']   = [ ];
            $data['folders'] = [ 'Public', 'Protected' ];
            $folder          = new Folder('', $data);

            return $folder;
        }

        if (!$this->isValidPath($path))
        {
            return false;
        }

        $folder = parent::getFolder($path);

        if (!$folder && strpos($path, '/') === false) // Public or Protected folder
        {
            $data            = [ ];
            $data['files']   = [ ];
            $data['folders'] = [ ];
            $folder          = new Folder('', $data);

            return $folder;
        }

        return $folder;
    }
669931
public static function isAbsolutePath($path)
    {
        if (isset($path[0]) and ($path[0] == '/' or $path[0] == '\\')) {
            return true;
        }
        if (preg_match('/^[A-Za-z0-9]+:/', $path) === 1) {
            return true;
        }
        return false;
    }
639454
public static function removePath($path)
    {
        $result = false;

        $path = realpath($path);
        if ($path) {
            self::remove($path);
            $result = true;
        }

        return $result;
    }
32368
public static function mkdir(string $path)
    {
        if (!is_dir($path))
        {
            mkdir($path, self::$dir_mode, true);
        }
    }