List remote files on $dir.

@param string $dir

@return array|FALSE
163741
public function ls($dir = null)
    {
        $dir = $this->_getAbsoluteRemotePath(null === $dir ? $this->_remotepath : $dir);
        if (false === $ls = @scandir($dir)) {
            return $this->_trigger_error(sprintf('Unable to list files of remote directory %s.', $dir));
        }

        return $ls;
    }
948237
public function scanDir($dir)
    {
        return collect(scandir($dir))->map(function ($item) use ($dir) {
            return $dir.DIRECTORY_SEPARATOR.$item;
        });
    }
1072165
private function __dir(string $dir) : bool
  {
    if (!is_dir($dir)) {
      mkdir($dir, 0777, true);
    }

    if (is_dir($dir)) return true;

    return false;
  }
383130
public function ls($dir = '')
    {
        $dir = ($dir == '' ? getcwd() : $dir);
        $this->errorHandler->start();
        if (($files = $this->driver->scandir($dir, 0, $this->resource)) !== false) {

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

        return false;
    }
311799
private function get_mboxes($dir){
    if ( $this->is_connected() ){
      return imap_getmailboxes($this->stream, $this->mbParam, $dir);
    }
    return false;
  }
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;
    }
159590
public function ftpFiles($dir)
    {
        return ($this->isConnected() === true) ? ftp_nlist($this->getConnection(), $dir) : false;
    }
549866
private function getFolderContent($dir)
    {
        $finder = Finder::create()
            ->ignoreVCS(false)
            ->ignoreDotFiles(false)
            ->depth(0)
            ->in($dir);

        return iterator_to_array($finder);
    }
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);
        }
    }
116529
public static function list_files($dir, $dirfile = false, $md5 = true, $root = true)
    {
        static $return = [];
        if ($root) {
            $return = [];
        }
        $filepoint = opendir($dir);
        while (($target = readdir($filepoint)) !== false) {
            if ("." == $target || ".." == $target) {
                continue;
            }
            if (is_dir($dir . $target)) {
                self::list_files($dir . $target . '/', $dirfile, $md5, false);
            } else {
                if ($md5) {
                    $file = $dirfile ? $dir . $target : $target;
                    $return[md5_file($dir . $target)] = $file;
                } else {
                    $file = $dirfile ? $dir . $target : $target;
                    $return[] = $file;
                }
            }
        }
        closedir($filepoint);
        return $return;
    }
1201531
public static function ls($dir): array
    {
        $contents = [];

        $flags = \FilesystemIterator::KEY_AS_PATHNAME
            | \FilesystemIterator::CURRENT_AS_FILEINFO
            | \FilesystemIterator::SKIP_DOTS;

        $dirIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, $flags));

        foreach ($dirIterator as $path => $fi) {
            $contents[] = $path;
        }

        natsort($contents);
        return $contents;
    }
1066844
public function find_all_files($dir) 
	{
		$root = array_reverse(scandir($dir));
		if(count($root) == 0) return;
		
		foreach($root as $value)
		{
			if($value === '.' || $value === '..')
			{
				continue;
			}
			if(is_file("$dir/$value"))
			{
				$result[] = "$dir/$value";
				$this->posts[] = $this->read( "$dir/$value", $value );
				continue;
			}
			foreach($this->find_all_files("$dir/$value") as $value)
			{
				$result[] = $value;
			}
		}
		return $result;
	}
314347
private function list_subscribed($dir){
    if ( $this->is_connected() ){
      return imap_lsub($this->stream, $this->mbParam, $dir);
    }
    return false;
  }
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;
    }
766022
public function getFilesList($dir)
	{
		$list = [];
		$iterator = Aws\recursive_dir_iterator($dir);
		foreach ($iterator as $filename) {
			$list[] = $filename;
		}
		return $list;
	}
751744
public function find_all_files($dir) 
	{
		$root = scandir($dir);
		if(count($root) == 0) return;

		foreach($root as $value)
		{
			if($value === '.' || $value === '..')
			{
				continue;
			}
			if(is_file("$dir/$value"))
			{
				$result[] = "$dir/$value";
				$this->pages[] = $this->read( "$dir/$value", $value );
				continue;
			}
			foreach($this->find_all_files("$dir/$value") as $value)
			{
				$result[] = $value;
			}
		}
		return $result; 
	}
723812
public function mkdir($dir)
    {
        return ($this->isConnected() === true) ? ftp_mkdir($this->getConnection(), $dir) : false;
    }