STD.File.RemoteDirectory( machineIP, dir [ , mask ][ , recurse ][ , planeName ] )
machineIP | A null-terminated string containing the IP address of the remote machine. Optional if planeName is provided. |
dir | A null-terminated string containing the path to the directory to read. This must be in the appropriate format for the operating system running on the remote machine. |
mask | Optional. A null-terminated string containing the filemask specifying which files to include in the result. If omitted,the default is '*' (all files). |
recurse | Optional. A boolean flag indicating whether to include files from sub-directories under the directory. If omitted, the default is FALSE. |
planeName | A null-terminated string containing name of the data plane containing the file. Optional if machineIP is provided, but planeName is preferred. |
Return: | RemoteDirectory returns a dataset in the following format: |
EXPORT FsFilenameRecord := RECORD STRING name; //filename UNSIGNED8 size; //filesize STRING19 modified; //date-time stamp END;
The RemoteDirectory function returns a list of files as a dataset in the format listed above from the specified machineIP and directory. If recurse is set to TRUE, then the name field contains the relative path to the file from the specified directory.
The mask argument is a string that can include wildcard characters. Valid wildcard characters are '*' (to match zero or more characters) and '?' (to match exactly one character). Non-wild characters are matched exactly and are case-sensitive.
Example:
IMPORT STD; machineIP := ''; dir := '/var/lib/HPCCSystems/dropzone/training'; recurse:= FALSE; planeName := 'mydropzone'; OUTPUT(STD.File.RemoteDirectory(machineIP,dir,'*.csv',recurse,planeName));