@param string $dir
@param int    $mode

@return void
771236
public function dirCreate($dir, $mode = 0755)
    {
        $this->_dirCreate($this->alias->resolve($dir), $mode);
    }
646580
private function rmdir($dir)
    {
        // remove all files
        $files = scandir($dir);
        foreach ($files as $file) {
            if ($file == '.' || $file == '..') {
                continue;
            }

            $path = $dir . '/' . $file;
            if (is_dir($path)) {
                $this->rmdir($path);
            } elseif (is_file($path)) {
                unlink($path);
            }
        }

        rmdir($dir);
    }
644272
public function delDir($dir)
    {
        $dir = $this->checkpath($dir);
        if (@!ftp_rmdir($this->linkid, $dir)) {
            $this->close();
            return false;
        }
        $this->close();
        return true;
    }
417023
private function chmod(string $path, int $mode): bool
    {
        if (!@chmod($path, $mode)) {
            $message = 'Could not change file mode.';
            if ($error = error_get_last()) {
                $message .= sprintf(' Errno: %d; %s', $error['type'], $error['message']);
            }
            throw new FileException($message);
        }

        return true;
    }
16707
private function _rrmdir($dir)
    {
        if ($handle = opendir($dir)) {
            while (false !== ($file = readdir($handle))) {
                if ($file != '.' && $file != '..') {
                    if (is_dir($dir . '/' . $file)) {
                        $this->_rrmdir($dir . '/' . $file);
                        rmdir($dir . '/' . $file);
                    } else {
                        unlink($dir . '/' . $file);
                    }
                }
            }
            closedir($handle);
        }
    }
319251
public function setLogDir($dir)
    {
        $dir = str_replace("\\", "/", $dir);
        $dir = rtrim($dir, '/');
        
        $this->logDir = $dir;
    }
702741
public static function createDir($dir, $mode = 0777)
    {
        if (is_dir($dir) || @mkdir($dir, $mode)) return TRUE;
        if (!static::createDir(dirname($dir), $mode)) return FALSE;
        return @mkdir($dir, $mode);
    }
593919
public function rmdir($dir) {
		$this->connectIfNeeded();
		$this->handle->rmdir($dir);
		$this->onFolderDeleted(new Event(['sender' => $this, 'data' => $dir]));
	}
1272349
public function makeDirectory($dirname, $mode = 0777)
    {
        $directories = explode('/', $dirname);

        foreach ($directories as $directory) {
            if (false === $this->makeActualDirectory($directory, $mode)) {
                chdir($this->base_directory);
                return false;
            }
            chdir($directory);
            $this->current_working_dir = getcwd();
        }

        chdir($this->base_directory);

        return true;
    }
85405
public function setTmpDir ($dir)
		{
			$this->_tmpDir = $dir . '/' . $this->_params[ 'identifier' ];
			if (!is_dir($this->_tmpDir))
				FileHelper::createDirectory($this->_tmpDir);
		}
890210
public function makeDirectory($dirname, $mode = 0777)
    {
        $connection = $this->getConnection();

        $directories = explode('/', $dirname);

        foreach ($directories as $directory) {
            if (false === $this->makeActualDirectory($directory, $mode)) {
                $this->setConnectionRoot();
                return false;
            }
            ftp_chdir($connection, $directory);
        }

        $this->setConnectionRoot();

        return true;
    }
66137
protected function setAdminModeCheckout($mode)
    {
        $this->admin = null;

        if ($this->access('order_add')) {

            if ($mode === 'add') {
                $this->admin = 'add';
            }

            if ($mode === 'clone' && $this->access('order_edit')) {
                $this->admin = 'clone';
            }
        }
    }
1228762
public function _dirCreate($dir, $mode = 0755)
    {
        /** @noinspection NotOptimalIfConditionsInspection */
        if (!is_dir($dir) && !@mkdir($dir, $mode, true) && !is_dir($dir)) {
            throw new CreateDirectoryFailedException(['create `:dir` directory failed: :last_error_message', 'dir' => $dir]);
        }
    }
573710
public void setCacheDir(String dirName, int mode) {
        if (sDebug) {
            LogUtils.v(TAG, "setCacheDir() dirName=" + dirName + " mode=" + mode);
        }
        if (dirName == null) {
            mCacheDirName = DIR_NAME_DEFAULT;
        } else {
            mCacheDirName = dirName;
        }
        mMode = mode;
        checkCacheDir(true);
    }
1296999
public static function chmod($path, $mode = NULL)
    {
        if (!isset($mode)) {
            if (is_file($path)) {
                $mode = Constants::FILESYSTEM_FILE_PERMISSIONS_DEFAULT;
            } elseif (is_dir($path)) {
                $mode = Constants::FILESYSTEM_DIR_PERMISSIONS_DEFAULT;
            } else {
                return false;
            }
        }
        $umask = umask();
        $res = chmod($path, $mode);
        umask($umask);

        return $res;
    }
990209
protected function detectDir($dir)
    {
        if ($this->autoMkdir && !file_exists($dir)) {
            mkdir($dir, $this->dirMode, true);
        }
    }
544179
protected function flushDir($dir)
    {
        if (!file_exists($dir)) {
            echo "HELP cant find ".$dir."\n";
            return;
        }
        $objects = scandir($dir);
        foreach ($objects as $object) {
            try {
                $this->deleteFile($object, $dir);
            } catch (Exception $e) {
                echo "Can't remove Folder/File ".$dir.DIRECTORY_SEPARATOR.$object."<br />\n"
                        . $e->getMessage()."<br />\n";
            }
        }
    }