FtpClient.php
public function rawlist($directory = '.', $recursive = false, $includeHidden = false)
    {
        if (!$this->isDir($directory)) {
            throw new FtpException('"' . $directory . '" is not a directory.');
        }

        if ($includeHidden) {
            $directory = "-la $directory";
        }

        $list = $this->ftp->rawlist($directory);
        if (false === $list) {
            // $list can be false, convert to empty array
            $list = [];
        }

        $items = [];
        if (false == $recursive) {
            foreach ($list as $path => $item) {
                $chunks = preg_split("/\s+/", $item);
                // if not "name"
                if (empty($chunks[8]) || $chunks[8] == '.' || $chunks[8] == '..') {
                    continue;
                }
                $path = $directory . '/' . $chunks[8];
                if (substr($path, 0, 2) == './') {
                    $path = substr($path, 2);
                }
                $items[$this->rawToType($item) . '#' . $path] = $item;
            }

            return $items;
        }

        foreach ($list as $item) {
            $len = strlen($item);
            if (!$len
                // "."
                || ($item[$len - 1] == '.' && $item[$len - 2] == ' '
                    // ".."
                    or $item[$len - 1] == '.' && $item[$len - 2] == '.' && $item[$len - 3] == ' ')
            ) {
                continue;
            }
            $chunks = preg_split("/\s+/", $item);
            // if not "name"
            if (empty($chunks[8]) || $chunks[8] == '.' || $chunks[8] == '..') {
                continue;
            }
            $path = $directory . '/' . $chunks[8];
            if (substr($path, 0, 2) == './') {
                $path = substr($path, 2);
            }
            $items[$this->rawToType($item) . '#' . $path] = $item;
            if ($item[0] == 'd') {
                $sublist = $this->rawlist($path, true);
                foreach ($sublist as $subpath => $subitem) {
                    $items[$subpath] = $subitem;
                }
            }
        }

        return $items;
    }
public function rawlist($directory = '.', $recursive = false, $includeHidden = false)
    {
        if (!$this->isDir($directory)) {
            throw new FtpException('"' . $directory . '" is not a directory.');
        }

        if ($includeHidden) {
            $directory = "-la $directory";
        }

        $list = $this->ftp->rawlist($directory);
        if (false === $list) {
            // $list can be false, convert to empty array
            $list = [];
        }

        $items = [];
        if (false == $recursive) {
            foreach ($list as $path => $item) {
                $chunks = preg_split("/\s+/", $item);
                // if not "name"
                if (empty($chunks[8]) || $chunks[8] == '.' || $chunks[8] == '..') {
                    continue;
                }
                $path = $directory . '/' . $chunks[8];
                if (substr($path, 0, 2) == './') {
                    $path = substr($path, 2);
                }
                $items[$this->rawToType($item) . '#' . $path] = $item;
            }

            return $items;
        }

        foreach ($list as $item) {
            $len = strlen($item);
            if (!$len
                // "."
                || ($item[$len - 1] == '.' && $item[$len - 2] == ' '
                    // ".."
                    or $item[$len - 1] == '.' && $item[$len - 2] == '.' && $item[$len - 3] == ' ')
            ) {
                continue;
            }
            $chunks = preg_split("/\s+/", $item);
            // if not "name"
            if (empty($chunks[8]) || $chunks[8] == '.' || $chunks[8] == '..') {
                continue;
            }
            $path = $directory . '/' . $chunks[8];
            if (substr($path, 0, 2) == './') {
                $path = substr($path, 2);
            }
            $items[$this->rawToType($item) . '#' . $path] = $item;
            if ($item[0] == 'd') {
                $sublist = $this->rawlist($path, true);
                foreach ($sublist as $subpath => $subitem) {
                    $items[$subpath] = $subitem;
                }
            }
        }

        return $items;
    }
public function rawlist ( $ directory = '.' , $ recursive = false , $ includeHidden = false ) { if ( ! $ this -> isDir ( $ directory ) ) { throw new FtpException ( '"' . $ directory . '" is not a directory.' ) ; } if ( $ includeHidden ) { $ directory = "-la $directory" ; } $ list = $ this -> ftp -> rawlist ( $ directory ) ; if ( false === $ list ) { // $list can be false, convert to empty array $ list = [ ] ; } $ items = [ ] ; if ( false == $ recursive ) { foreach ( $ list as $ path => $ item ) { $ chunks = preg_split ( "/\s+/" , $ item ) ; // if not "name" if ( empty ( $ chunks [ 8 ] ) || $ chunks [ 8 ] == '.' || $ chunks [ 8 ] == '..' ) { continue ; } $ path = $ directory . '/' . $ chunks [ 8 ] ; if ( substr ( $ path , 0 , 2 ) == './' ) { $ path = substr ( $ path , 2 ) ; } $ items [ $ this -> rawToType ( $ item ) . '#' . $ path ] = $ item ; } return $ items ; } foreach ( $ list as $ item ) { $ len = strlen ( $ item ) ; if ( ! $ len // "." || ( $ item [ $ len - 1 ] == '.' && $ item [ $ len - 2 ] == ' ' // ".." or $ item [ $ len - 1 ] == '.' && $ item [ $ len - 2 ] == '.' && $ item [ $ len - 3 ] == ' ' ) ) { continue ; } $ chunks = preg_split ( "/\s+/" , $ item ) ; // if not "name" if ( empty ( $ chunks [ 8 ] ) || $ chunks [ 8 ] == '.' || $ chunks [ 8 ] == '..' ) { continue ; } $ path = $ directory . '/' . $ chunks [ 8 ] ; if ( substr ( $ path , 0 , 2 ) == './' ) { $ path = substr ( $ path , 2 ) ; } $ items [ $ this -> rawToType ( $ item ) . '#' . $ path ] = $ item ; if ( $ item [ 0 ] == 'd' ) { $ sublist = $ this -> rawlist ( $ path , true ) ; foreach ( $ sublist as $ subpath => $ subitem ) { $ items [ $ subpath ] = $ subitem ; } } } return $ items ; }
Returns a detailed list of files in the given directory.

@see FtpClient::nlist()
@see FtpClient::scanDir()
@see FtpClient::dirSize()

@param string $directory The directory, by default is the current directory
@param bool $recursive
@param bool $includeHidden

@return array

@throws FtpException
Returns a detailed list of files in the given directory .