List Option (-LS)

Use the List Option adapter command (-LS) to allow files to be retrieved based on a user supplied sorting preference.

This command is used with the existing FTP URL (-URL) adapter command and supports a subset of FTP options that control the order in which the files are transferred.

This is an optional command.


-LS sort_type

The adapter passes the -LS command value to a remote FTP server as an argument when it lists the files in the directory. One of three events happens:

  • FTP server accepts the option and lists the files in the specified order
  • FTP server ignores the option and lists the files in the default order
  • FTP server rejects the option and the adapter returns an error

For example:


-URL ftp://testftp:test@host/mydir -ls tr

The -LS command is issued by the adapter before any file transfer, so that its results are used to control the order of the file transfer. In the example above, all files from mydir would be transferred, the oldest file being transferred first.

Allowable command options include:

Option
Description
t
Sorts by time stamp.
r
Reverses the order of sort.
tr
Reverses the order of sort by time stamp.
rt
Same as -LS tr.

All other list options result in the error message: invalid ls option that is logged in the adapter trace file.

The List Option (-LS) command options, (t, r, tr, and rt) can be ignored by some ftp servers.