Change the current working directory on the Local machine.

@param string $dir The directory on the remote machine to enter, start with '/' for absolute path.

@return boolean True if changed dir, false otherwise.
518781
public function cd($dir = '')
    {
        $this->errorHandler->start();
        if ($this->driver->chdir($dir)) {
            $this->errorHandler->stop();

            return true;
        }
        $this->errorHandler->stop();

        return false;
    }
661666
public static function makeDir($dir) {
		$fs = new Filesystem();
		try {
			$fs->mkdir($dir);
		} catch (IOExceptionInterface $e) {
			Console::writeError("an error occurred while creating your directory at <path>".$e->getPath()."</path>...");
		}
		unset($fs);
	}
990209
protected function detectDir($dir)
    {
        if ($this->autoMkdir && !file_exists($dir)) {
            mkdir($dir, $this->dirMode, true);
        }
    }
280087
protected function _rmdir( $dir )
    {
        $iterator = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator( $dir,
                RecursiveDirectoryIterator::CURRENT_AS_FILEINFO |
                RecursiveDirectoryIterator::SKIP_DOTS
            ),
            RecursiveIteratorIterator::CHILD_FIRST
        );

        $result = true;

        foreach ( $iterator as $info )
        {
            $path = $info->getPathname();

            switch ( true )
            {
                case $info->isFile():
                case $info->isLink():
                    $result = $result && @ unlink( $path );
                    break;

                case $info->isDir():
                    $result = $result && @ rmdir( $path );
                    break;
            }

        }

        return $result && @ rmdir( $dir );
    }
319251
public function setLogDir($dir)
    {
        $dir = str_replace("\\", "/", $dir);
        $dir = rtrim($dir, '/');
        
        $this->logDir = $dir;
    }
13607
public static function recursiveUnlink($dir) {
        $result = TRUE;

        if(is_dir($dir)) {
            foreach(scandir($dir) as $sub) {
                if(in_array($sub, ['.', '..'])) continue;
                $result &= self::recursiveUnlink("$dir/$sub");
            }

            $result &= rmdir($dir);
        }
        elseif(is_file($dir)) {
            $result &= unlink($dir);
        }
        else {
            $result = FALSE;
        }

        return (bool)$result;
    }
604858
public function setLocation($dir = 'bulletproof', $permission = 0666)
    {
      $isDirectoryValid = $this->isDirectoryValid($dir);

      if (!$isDirectoryValid) {
        $this->error = sprintf($this->commonUploadErrors[$this->language]['ERROR_04'], $dir);
        return false;
      }

      $create = !is_dir($dir) ? @mkdir('' . $dir, (int) $permission, true) : true;

      if (!$create) {
        $this->error = sprintf($this->commonUploadErrors[$this->language]['ERROR_05'], $dir);
        return false;
      }

      $this->location = $dir;

      return $this;
    }
779315
private function scandir($dir) {
        $dir = trim($dir, '/') . '/';
        $absolute = $this->absolute($dir);
        $files = scandir($absolute);

        foreach ($files as $file) {
            // ignore relative references
            if ($file === "." || $file === "..") {
                continue;
            }

            if (is_dir($absolute . $file)) {
                $this->scandir($dir . $file);
            } else {
                // we want the relative path inside the input_dir so we can
                // put the file in the same place in the output_dir
                $path = preg_replace("#^" . Config::get('input_dir') .  "#", "", $dir . $file);
                $this->paths[] = array(
                    'path' => $path
                );
            }
        }
    }
1029017
protected function mkDir($dir)
    {
        if (!file_exists($dir)) {
            mkdir($dir, self::DIR_MODE, true);
            chmod($dir, self::DIR_MODE);
        }
        if (!is_dir($dir)) {
            throw new \Exception("Failed to create directory: $dir");
        }
    }
869456
function _remove_dir($dir)
    {
        $dirs = explode('/', preg_replace('#^/|/(?=/)|/$#', '', $dir));

        $temp = &$this->dirs;
        foreach ($dirs as $dir) {
            if ($dir == end($dirs)) {
                unset($temp[$dir]);
                return true;
            }
            if (!isset($temp[$dir])) {
                return false;
            }
            $temp = &$temp[$dir];
        }
    }
54185
protected function processDir($dir) {
    $dir = $this->replacePattern($dir);
    // The absolute path has to be calculated relative to the configuration file
    if (Path::isRelative($dir)) {
      $dir = Path::makeAbsolute($dir, dirname($this->configFile));
    }
    return rtrim($dir, '/');
  }
397585
static public function
	MakeDirectory($dir) {
	/*//
	@argv string Directory
	@return bool

	make a directory. returns if successful or not. allows you to
	blindly call it if it already exists to ensure it exists.
	//*/

		// if it already exists...
		if(is_dir($dir)) return true;

		// make it...
		$umask = umask(0);
		@mkdir($dir,0777,true);
		umask($umask);

		// find out if it was successful, lol.
		return is_dir($dir);
	}
139806
public function setDir($dir)
    {
        if (!is_dir($dir) && !@mkdir($dir, 0755, true)) {
            $message = sprintf('Failed to create directory "%s"', $dir);
            ($e = error_get_last()) && $message .= ': ' . $e['message'];
            throw new \RuntimeException($message);
        }
        $this->dir = realpath($dir);
        return $this;
    }
582924
protected function rmdir($dir) {
        $iterator = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($dir),
            RecursiveIteratorIterator::CHILD_FIRST
        );

        foreach ($iterator as $file) {
            $name = $file->getPathname();

            if (substr($name, -1) === '.') {
                continue;
            }

            if ($file->isDir()) {
                // Remove dir
                rmdir($name);
            } else {
                // Remove file
                unlink($name);
            }
        }

        // Remove the directory itself
        rmdir($dir);
    }
1049429
public function changeDirectory($directory)
    {
        $result = @ftp_chdir($this->connection, $directory);
        
        if ($result === false) {
            throw new Exception('Unable to change directory');
        }

        return $this;
    }
830922
function rmdir($dir)
    {
        if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
            return false;
        }

        $dir = $this->_realpath($dir);
        if ($dir === false) {
            return false;
        }

        if (!$this->_send_sftp_packet(NET_SFTP_RMDIR, pack('Na*', strlen($dir), $dir))) {
            return false;
        }

        $response = $this->_get_sftp_packet();
        if ($this->packet_type != NET_SFTP_STATUS) {
            user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE);
            return false;
        }

        extract(unpack('Nstatus', $this->_string_shift($response, 4)));
        if ($status != NET_SFTP_STATUS_OK) {
            // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED?
            $this->_logError($response, $status);
            return false;
        }

        $this->_remove_dir($dir);

        return true;
    }
968712
protected function ensureDirectory($dir)
    {
        if ($this->filesystem->isDirectory($dir)) {
            return true;
        }

        if (!@$this->filesystem->makeDirectory($dir)) {
            throw new RuntimeException("Cannot create base directory '$dir'");
        }

        return true;
    }