Get Directories
Verb: getDirectories
Gets all directories in a folder according to the specified criteria.
Syntax
getDirectories --path(String) [--recursive(Boolean)] [--filemask(String)] [--orderbyname(Boolean)] [--orderbylastmodification(Boolean)] [--reverseordering(Boolean)] [--fileSystem(FileSystem)] (List<String>)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--path | Directory | Required | Text | Folder containing the directories that should be obtained.
The path of an existing directory must be informed. If it does not exist, it is possible to create it through Create Directory. |
--recursive | Recursive search | Optional | Boolean | When enabled, gets subfolders from the Directory. |
--filemask | Pattern | Optional | Text | Searches for the folder by name using a pattern.
The full name of the directory can be inserted, or just a part of it, as IBM RPA Studio searches and returns the desired directories. |
--orderbyname | Order by name | Optional | Boolean | When enabled, sorts the Obtained directories alphabetically by name. |
--orderbylastmodification | Order by last modification | Optional | Boolean | When enabled, sorts the Obtained directories by modification date. |
--orderbyextension | Order by extension(Obsolete) | Optional | Boolean | When enabled, sorts the Obtained directories in alphabetical order of the file extensions.
This parameter is obsolete, it is no longer necessary due to enhancements made to the tools. |
--orderbysize | Order by size(Obsolete) | Optional | Boolean | When enabled, sorts the Obtained directories by file size.
This parameter is obsolete, it is no longer necessary due to enhancements made to the tools. |
--reverseordering | Reverse ordering | Optional | Boolean | When enabled, sorts the Obtained directories in descending order. |
--fileSystem | File system | Optional | File System | Connection variable to a file system.
1. To obtain the connection variable to an available file system, this connection must be established using one of the following commands: IBM RPA Control Center. 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 | Obtained directories | List<Text> | List of directories found in the folder from the Directory parameter. These directories are sorted according to what is selected in the input parameters. |
Example
Get directories, sorted by name in descending order.
defVar --name directoriesGotten --type List --innertype String
defVar --name filePaths --type String
getSpecialFolder --folder "MyDocuments" filePaths=value
// Gets all directories, ordering them by name in descending order.
getDirectories --path "${filePaths}" --orderbyname --reverseordering directoriesGotten=value
logMessage --message "${directoriesGotten}" --type "Info"
Remarks
The parameters Order by extension, Order by last modification, Order by name, Order by size, and Reverse ordering can be selected and combined.