PHP ftp_nlist() Function

The ftp_nlist() function returns a list of files in the specified directory on the FTP server.

array ftp_nlist ( resource $ftp_stream , string $directory )

Example -

The above example will output something similar to : -

array(3) {
  [0]=>
  string(11) "public_html"
  [1]=>
  string(10) "public_ftp"
  [2]=>
  string(3) "www"

ParameterDescription
ftp_streamThe link identifier of the FTP connection
directoryThe directory to be listed. This parameter can also include arguments, eg. ftp_nlist($conn_id, "-la /your/dir"); Note that this parameter isn't escaped so there may be some issues with filenames containing spaces and other characters

Returns an array of filenames from the specified directory on success or FALSE on error.