phpseclib\Net\SFTP::rawlist PHP Method

rawlist() public method

Returns a detailed list of files in the given directory
public rawlist ( string $dir = '.', boolean $recursive = false ) : mixed
$dir string
$recursive boolean
return mixed
    function rawlist($dir = '.', $recursive = false)
    {
        $files = $this->_list($dir, true);
        if (!$recursive || $files === false) {
            return $files;
        }
        static $depth = 0;
        foreach ($files as $key => $value) {
            if ($depth != 0 && $key == '..') {
                unset($files[$key]);
                continue;
            }
            if ($key != '.' && $key != '..' && is_array($this->_query_stat_cache($this->_realpath($dir . '/' . $key)))) {
                $depth++;
                $files[$key] = $this->rawlist($dir . '/' . $key, true);
                $depth--;
            } else {
                $files[$key] = (object) $value;
            }
        }
        return $files;
    }

Usage Example

Esempio n. 1
0
 /**
  * @param null|string $Name
  *
  * @return SFTP\Directory[]|SFTP\File[]
  */
 public function listDirectory($Name = null)
 {
     $this->persistConnection();
     if (null === $Name) {
         $Name = $this->Connection->pwd();
     }
     $List = $this->Connection->rawlist($Name);
     $Return = array();
     foreach ($List as $Item => $Attributes) {
         if ($this->Connection->is_dir($Item)) {
             $Return[$Item] = new Directory($this, $Attributes);
         }
         if ($this->Connection->is_file($Item)) {
             $Return[$Item] = new File($this, $Attributes);
         }
     }
     return $Return;
 }
All Usage Examples Of phpseclib\Net\SFTP::rawlist