DirList

Summary

The DirList function returns a status result set listing the details of the files and subdirectories found on the Connect SFTP server for the given directory search parameter.

Syntax

DirList([FilePath=<path to file>]
[, Directory=<directory>]
[, Filter=<wildcard filter>]
[, Regex=<regular expression>]
[, Recursive=true|false])

Parameters

Parameter Description
FilePath (Optional) String value or expression containing the full Unix-style path name and file name to list. If no path is given, the root SFTP directory is assumed.
Directory (Optional) String value or expression when listing a directory name or directory path without a file name. Format is Unix-style.
Filter (Optional) String value containing wildcard search expressions. Restricts the result set to only those files and directories matching the filter expression.
Regex (Optional) Use when you require more complicated search patterns. A string value containnig a Java regular expression.
Recursive (Optional) Default is false, listing only files and sub directories within the specified directory.. When Recursive=true, the parent directory is listed in the result set along with the contents of all files and subdirectories directories traversed recursively.

Details

Connect is integrated with Xactly’s SFTP server, connectftp.xactlycorp.com. Connect’s file commands can read and write files and manipulate directory structures located on the SFTP file system. An SFTP account is not required to use these functions. However, one is required to access the file system via SFTP clients. Contact Xactly Customer Support to setup an SFTP account if your business does not already have one.

The following table describes the result set returned by the command:

Column Name Data Type Description
name string The file or directory name for the given row.
parent string The directory path for the given name value. Includes the entire nested directory struction in Unix-style format. Null indicates the base/root directory.
is_file boolean True if a file. False if a directory.
is_directory boolean True if a directory. False if a file.
size integer File size in bytes.
owner string File system owner for the file or directory.
created_instant instant The SFTP server file system time when the file or directory was created.
accessed_instant instant The SFTP server file system time when the file or directory was read.
modified_instant instant The SFTP server file system time when the file or directory was changed.

Examples

call DirList(FilePath='/tmp/foo.csv');

dirlist_01

call DirList(Directory='/tmp', Filter='*.csv');

dirlist_02

select * 
from (DirList(Directory='/'))
where is_directory=true;

dirlist_03

call DirList(Directory='/', Regex='.+.txt');

dirlist_04

Related Commands

Exists