Share this page

# ftp_dir_ex

FTP Functions (ftp)

Runs the dir command on the FTP server for a specific session.

    int ftp_dir_ex( FTP *ppftp, char *transaction, <item list>, LAST );

Function objFTP.dir_ex( ppftp as FTP, transaction as String, item list as String, LAST ) as Integer ` for VB Script

ppftp | An FTP session identifier.
transaction | A transaction name for this step. To instruct VuGen not to create a transaction for this step, use a NULL string, "".
item_list | A list of all the items for this function. Enclose all entries with quotes. PATH - The full path of the location at which to run the dir command. OUTPUT (optional) - The path and file name for writing the results of the dir. If this option is not specified, the dir results are saved to the Vuser log file when the Extended log > Data returned by server option is enabled in the Runtime settings. PASSIVE (optional) - Sets the communication protocol to Passive Mode FTP. To enable, pass "PASSIVE=TRUE". ENDITEM - Marks the end of the list. (no quotes)
KIND | The command to run. For example, "KIND=MLSD"
LAST | A marker indicating the end of the argument list.

The ftp_dir_ex function runs the dir command on the FTP server for the specified session.

This function is for use with multiple sessions. For global sessions, use the ftp_dir function, which leaves out the session identifier.

## Return Values

If this function succeeds, it returns LR_PASS. Otherwise, it returns LR_FAIL.

## Parameterization

The following argument(s) can be parameterized with standard parameterization: List of Attributes

## Example

In the following example, the ftp_dir_ex function runs the dir command in the pub/test directory.

        FTP pFTP;

        // Logon to the FTP server

        ftp_logon_ex (&pFTP, "FTP", "URL=ftp://ftp.microsoft.com",
                LAST );

        // Run dir on the pub/test directory

        ftp_dir_ex(&pFTP,"FtpDir",
    		"PATH=pub/test",
    		"KIND=MLSD",
    		ENDITEM,
    		LAST);

        // Logout from the FTP server

        ftp_logout_ex(&pFTP);

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: