Name: libURLSetFTPListCommand

Type: command

Syntax: libURLSetFTPListCommand {"LIST" | "NLST"}

Summary: Switches between sending LIST or NLST formats when listing the contents of an <FTP> <folder|directory>.

Introduced: 2.0

OS: mac,windows,linux

Platforms: desktop,server,web

Security: network

Example:
libURLSetFTPListCommand "NLST"

Example:
libURLSetFTPListCommand (the listCommand of this card)

Description:
Use the <libURLSetFTPListCommand> <command> to get a simple list of <files> in an <FTP> <folder|directory>.

A URL that ends with a slash (/) designates a directory (rather than a file). An <ftp> <URL> to a <folder|directory> evaluates to a listing of the <folder|directory's> contents. The format of a directory listing depends on which FTP command LiveCode sends to the <FTP> <server>. You specify which command to use with the <libURLSetFTPListCommand> <command>.

If you specify LIST, directory listings are returned in the same format as the Unix "ls" command and include information such as permissions, owner, size, and last modification date as well as the name of each file or subdirectory. Use this format if you need the additional information about each item in the directory.

If you specify NLST, directory listings consists of a list of names of files and subdirectories, one per line, without the additional information provided in a LIST listing. Use this format if you need a simple list of files and don't want to parse the more complex LIST listing for the file names.

The list command is set to LIST when the application starts up.

>*Important:*  <FTP> <server|servers> are not uniform in their response to a request for a directory listing. Some <server|servers> may format directory listings differently from these descriptions. These are the most common formats, but they are not universal.

>*Important:*  The <libURLSetFTPListCommand> <command> is part of the <Internet library>. To ensure that the <command> works in a <standalone application>, you must include this <Revolution custom library|custom library> when you create your <standalone application|standalone>. In the Inclusions section of the <Standalone Application Settings> window, make sure "Internet Library" is selected in the list of script libraries.

>*Note:* When included in a <standalone application>, the <Internet library> is implemented as a hidden <group> and made available when the <group> receives its first <openBackground> message. During the first part of the <application|application's> startup process, before this <message> is sent, the <libURLSetFTPListCommand> <command> is not yet available. This may affect attempts to use this <command> in <startup>, <preOpenStack>, <openStack>, or <preOpenCard> <handler|handlers> in the <main stack>. Once the <application> has finished starting up, the <library> is available and the <libURLSetFTPListCommand> <command> can be used in any <handler>.

References: URL (keyword), ftp (keyword), startup (message), openBackground (message), preOpenStack (message), openStack (message), preOpenCard (message), libURLftpCommand (function), files (function), server (glossary), main stack (glossary), handler (glossary), message (glossary), Standalone Application Settings (glossary), standalone application (glossary), group (glossary), folder (glossary), command (glossary), application (glossary), Internet library (library), library (library), Revolution custom library (library)

Tags: networking
