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 HTTP/HTTPS site.

 

 

This script command produces a directory listing of current FTP 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 the same as might be produced using the LIST command in a command line FTP client.

 

If you need a directory listing of a directory other than the current FTP site directory, you’d issue the following commands.

 

FTPCD "new_dir"

FTPLIST "listing of new_dir.txt"

 

You might also use the READFILE and one or more of the string mantipulation script commands (e.g., SETMID, SETLEFT) to parse the resulting text file for information important to your application.

 

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

 

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.

 

When connected to a HTTP/HTTPS site, the FTPLIST command will produce a unique listing.

 

Related Command(s): FTPCD, FTPMAKEDIR, FTPPWD