Connection.list(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Lists the remote directory.

This method returns an array of Objects. Each Object includes the following properties with associated values:

  • directory- A flag whether the entry corresponds to a directory or a file. If true, it is a directory. If false, it is a file.

  • name- The name of the file

  • size- The size of the file

  • lastModified- The last modification date

Returns

Array<Object>

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

10 units

Module

N/sftp Module

Since

2019.2

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.path

String

required

The relative path to directory of file that will be downloaded.

2019.2

options.sort

String

required

The sort options. Use values from sftp.Sort.

2019.2

Errors

Error Code

Thrown If

FTP_INVALID_DIRECTORY

The directory does not exist on the remote FTP server.

FTP_PERMISSION_DENIED

Access to the file or directory on the remote FTP server was denied.

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/sftp Module Script Samples.

          // Add additional code 
...

let objConnection = connection.list({
    path: 'yyy/test'
});
...
// Add additional code 

        
Note:

Wildcards are accepted. The ? symbol can represent any character. The * symbol can represent any number of characters.

Related Topics

sftp.Connection
N/sftp Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices