FTPLIST        List current FTP site directory to a file

Top  Previous  Next

Syntax:

FTPLIST

[ file name ] [ wildcards ]

Arguments:

[ file name ]

Optional variable or string defining a file name to write the directory listing to; if no path is defined Robo-FTP writes to a file named "sitelist.txt" in the working folder.

 

[ wildcards ]

Optional variable or string defining a wildcard pattern to apply to the directory listing. The [ file name ] option must be present if this optional argument is to be recognized.  Wildcards are not permitted when connected to a SFTP, HTTP, or HTTPS site.

 

 

This script command produces a directory listing of current remote site and writes it to a file. If [ file name ] is not specified, Robo-FTP creates a file in the working folder named "sitelist.txt". The directory format written to this file is similar to what might be produced using the MLSD or LIST commands in a command line FTP client.  If the directory listing is empty the sitelist.txt file will not be written or overwritten.

 

Important

The FTPLIST command is provided for auditing and tech support purposes only.  Do not build scripts or other processes that depend on the parsing the output file created by FTPLIST.  Instead you should use the FTPGETFILE or GETSITEFILE commands when designing a system that responds dynamically to the existence of remote files.  The FTPSNAPSHOT command might also be useful if you simply need to detect changes.

 

If you need a directory listing of a folder other than the current site directory, you’d need to first change directories.  For example:

 

FTPCD "new_dir"

FTPLIST "listing of new_dir.txt"

 

 

Here’s a sample listing from an FTP server hosted on a Unix system. The actual format will vary from site to site depending on the server.

 

drwxr-x---  2 roboftp  System      0 Jan 29 20:44 .

drwxr-x---  2 roboftp  System      0 Jan 29 20:44 ..

-rwxr-x---  1 roboftp  System  62976 Jan 29 20:44 bszip.dll

-rwxr-x---  1 roboftp  System    651 Jan 29 20:44 crontab.txt

-rwxr-x---  1 roboftp  System 413184 Jan 29 20:44 cryptotw.dll

-rwxr-x---  1 roboftp  System  32768 Jan 29 20:44 feedback.exe

-rwxr-x---  1 roboftp  System     17 Jan 29 20:44 welcome.txt

 

If you want a partial listing controlled by a wildcard pattern (e.g., all .txt files), use the following form of the command and the listing received will be as shown.

 

FTPLIST "listing of new_dir.txt" "*.txt"

 

rwxr-x---  1 roboftp  System    651 Jan 29 20:44 crontab.txt

rwxr-x---  1 roboftp  System     17 Jan 29 20:44 welcome.txt

 

To get a listing of a local folder, use the LISTDIR script command.

 

It is not uncommon for an HTTP or HTTPS site to refuse directory listings, in these cases the FTPLIST command will fail.

 

 

Related Command(s): FTPCD, FTPMAKEDIR, FTPPWD, LISTDIR