获取驱动列表.

@param string $dir 驱动目录

@return array 驱动列表
349381
public function getDeviceList($dir) {
        $path = array('.', '..', '.htaccess', '.DS_Store', 'controllers', 'config', 'debug', 'framework');
        $ext  = array("php", "html", "htm");
        $list = array();
        if (is_dir($dir)) {
            if ($handle = opendir($dir)) {
                while (($file = readdir($handle)) !== false) {
                    if (!in_array($file, $path) && !in_array(pathinfo($file, PATHINFO_EXTENSION), $ext)) {
                        $list[$file] = VENDOR_DIR . DS . FRAMEWORK . DS . $file;
                    }
                }
                closedir($handle);
            }
        }
        return $list;
    }
159912
public function ls($dir = '')
    {
        $this->isAlive(true);
        $this->errorHandler->start();
        $dir = ($dir == '' ? ftp_pwd($this->resource) : $dir);
        if (($ls = $this->driver->nlist($this->resource, $dir)) !== false) {
            $this->errorHandler->stop();

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

        return false;
    }
596912
public function items($directory)
    {
        $directory = ltrim($directory, "/");

        $iterator = new FilesystemIterator($this->pathRoot.$directory);

        $files = array();

        foreach ($iterator as $file) {
            $files[] = strval($file);
        }
        
        return $files;
    }
311799
private function get_mboxes($dir){
    if ( $this->is_connected() ){
      return imap_getmailboxes($this->stream, $this->mbParam, $dir);
    }
    return false;
  }
58821
private function get_names_mboxes($dir){
    if ( $mboxes = $this->get_mboxes($dir) ){
      $i = 0;
      $ret = [];
      while( list($key, $val) = each($mboxes) ){
        $name = imap_utf7_decode($val->name);
        $name_arr = explode('}', $name);
        $j = \count($name_arr) - 1;
        $mbox_name = $name_arr[$j];
        if( $mbox_name == "" ){
          continue; // the DIRECTORY itself
        }
        $ret[$i++] = $mbox_name;
      }
      sort($ret);
      return $ret;
    }
    return false;
  }
1189161
public void mkDirs(String dir) {
		final String[] dirs = StrUtil.trim(dir).split("[\\\\/]+");

		final String now = pwd();
		if(dirs.length > 0 && StrUtil.isEmpty(dirs[0])) {
			//首位为空，表示以/开头
			this.cd(StrUtil.SLASH);
		}
		for (int i = 0; i < dirs.length; i++) {
			if (StrUtil.isNotEmpty(dirs[i])) {
				if (false == cd(dirs[i])) {
					//目录不存在时创建
					mkdir(dirs[i]);
					cd(dirs[i]);
				}
			}
		}
		// 切换回工作目录
		cd(now);
	}
1118700
public function all($directory = '/')
    {
        $directories = $this->directories($directory)->transform(function ($item) {
            return $item + ['type' => self::MEDIA_TYPE_DIRECTORY];
        });

        $files = $this->files($directory)->transform(function (array $item) {
            return $item + ['type' => self::MEDIA_TYPE_FILE];
        });

        return array_merge($directories->toArray(), $files->toArray());
    }
422830
private function split(string $dir): array
    {
        $path = $this->dirToPath($dir);

        return explode('/', Str::normalizePath($path));
    }
711503
public function chdir($dir)
    {
        return ($this->isConnected() === true) ? ftp_chdir($this->getConnection(), $dir) : false;
    }
766022
public function getFilesList($dir)
	{
		$list = [];
		$iterator = Aws\recursive_dir_iterator($dir);
		foreach ($iterator as $filename) {
			$list[] = $filename;
		}
		return $list;
	}
435221
public function files($dir)
    {
        $dir = $this->alias->resolve($dir);

        $files = [];
        foreach ($this->glob($dir . (strpos($dir, '*') === false ? '/*' : ''), SCANDIR_SORT_ASCENDING) as $item) {
            if (is_file($item)) {
                $files[] = $item;
            }
        }

        return $files;
    }
946359
function recursiveRemoveDir($dir)
    {
        if (is_link($dir)) {
            @unlink($dir);
        } else if (is_dir($dir)) {
            $files = array_diff(@scandir($dir), array('.', '..'));
            foreach ($files as $file) {
                (is_dir("$dir/$file")) ? $this->recursiveRemoveDir("$dir/$file") : @unlink("$dir/$file");
            }
        }
        return @rmdir($dir);
    }
355203
public function rmdirr($dir)
    {
        if ($handle = opendir("$dir")) {
            while ($item = readdir($handle)) {
                if (($item != ".") && ($item != "..")) {
                    if (is_dir("$dir/$item")) {
                        $this->rmdirr("$dir/$item");
                    } else {
                        unlink("$dir/$item");
                    }
                }
            }
            closedir($handle);
            rmdir($dir);
        }
    }
536490
public function rmdir($dir)
    {
        return ($this->isConnected() === true) ? ftp_rmdir($this->getConnection(), $dir) : false;
    }
616977
public static function rmdir( $dir ) {
		$files = new RecursiveIteratorIterator(
			new RecursiveDirectoryIterator( $dir, RecursiveDirectoryIterator::SKIP_DOTS ),
			RecursiveIteratorIterator::CHILD_FIRST
		);

		foreach ( $files as $fileinfo ) {
			$todo = $fileinfo->isDir() ? 'rmdir' : 'unlink';
			$todo( $fileinfo->getRealPath() );
		}
		rmdir( $dir );
	}
1277526
protected function _scanDir($dir)
    {
        $dir = new Folder($dir);
        $contents = $dir->read(true, true);
        if (empty($contents[1])) {
            return [];
        }
        $shells = [];
        foreach ($contents[1] as $file) {
            if (substr($file, -4) !== '.php') {
                continue;
            }
            $shells[] = substr($file, 0, -4);
        }

        return $shells;
    }
948402
public function migrate($dir)
    {
        $migrate = [];


        if(file_exists($directory = '../App/'. $dir)) {

            foreach(array_reverse(glob($directory .'/*.php')) as $path) {

                $namespace = str_replace('/', '\\', 'App'. explode('.php', explode('App', $path)[1])[0]);

                if(method_exists($object = (new $namespace), 'create')) {

                    if($table = $object->create($this)) {

                        $migrate['created'][] = basename($namespace);
                    
                    } else {

                        $migrate['failed'][] = basename($namespace);
                    }

                } else {

                    $migrate['error'] = 'Method '. basename($namespace) . ':create() not exist.';
                }
            }

        } else {

            $migrate['error'] = 'Directory ' . $dir .' not exist.';
        }

        return $migrate;
    }