Get Files
Verb: getFiles
Gets the file paths that exist in a directory, and can also get file paths from subdirectories of that directory, returning those paths in a list.
Syntax
getFiles --path(String) [--recursive(Boolean)] [--filemask(String)] [--orderbyname(Boolean)] [--orderbylastmodification(Boolean)] [--orderbyextension(Boolean)] [--orderbysize(Boolean)] [--reverseordering(Boolean)] [--fileSystem(FileSystem)] (List<String>)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--path | Directory | Required | Text | Full path to the directory of which the file paths should be obtained. |
--recursive | Search in Subdirectories | Optional | Boolean | When enabled, searches files within subdirectories of the specified directory in the Directory parameter. |
--filemask | File Mask | Optional | Text | Filter that will be applied in the search. It must be inserted as follows: [Name or part of the file name, spaces are not accepted in this part]. [File extension]. Here are some examples:
When entering the name of the file, it must be case sensitive. |
--orderbyname | Order by Name | Optional | Boolean | Sorts the files by name, returning the file list in the Paths parameter. |
--orderbylastmodification | Order by Last Modification | Optional | Boolean | Causes the list returned in the output parameter Paths to be sorted by file modification date. |
--orderbyextension | Order by Extension | Optional | Boolean | Sorts files by extension, returning list of files in Paths parameter. |
--orderbysize | Order by Size | Optional | Boolean | Sorts the files by size, returning the file list in the Paths parameter. |
--reverseordering | Reverse Ordering | Optional | Boolean | Reverses the list's sorting. |
--fileSystem | File System | Optional | File System | Connection variable to a file system.
1. To obtain the connection variable with an available file system, this connection must be established using one of the following commands: Connect to Dropbox, Connect to Google Drive or Connect to Microsoft Corporation OneDrive, which must be pre-configured in the Web Client. 2. If nothing is specified in this parameter, the local file system of the operating system is used as default. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Paths | List<Text> | List containing the file paths found. |
Example
Example 1: The Get Files command returns the list of file paths from a specified folder.
defVar --name filePaths --type List --innertype String
// Download the following file to execute the command.
getFiles --path filesFolder.zip --orderbyname filePaths=value
logMessage --message "${filePaths}" --type "Info"
Example 2: The Get Files command returns the list of file paths of a specified folder, filtering the files by the mask "* .txt".
defVar --name filePaths --type List --innertype String
getFiles --path filesFolder.zip --filemask "*.txt" --orderbyname filePaths=value
logMessage --message "${filePaths}" --type "Info"