Get File Path

Gets a file path according to the defined parameters.

Important:IBM RPA 18.1.0.9 deprecated this command, and starting from IBM RPA 23.0.3, it is removed from the product. For more information, see Removed.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

getFilePath --path(String) [--filemask(String)] [--orderbyname(Boolean)] [--orderbylastmodification(Boolean)] [--orderbyextension(Boolean)] [--orderbysize(Boolean)] [--reverseordering(Boolean)] --position(Numeric) [--fileSystem(FileSystem)] (String)=value

Input parameter

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Directory path Required Text Folder that contains the wanted file.
Filter filemask Optional Text Characters used when searching for the file.
Sort by name orderbyname Optional Boolean Enable to sort the file path by name.
Sort by last modification date orderbylastmodification Optional Boolean Enable to sort the file path by last modification date.
Sort by extension orderbyextension Optional Boolean Enable to sort the file path by extension in alphabetical order.
Sort by size orderbysize Optional Boolean Enable to sort the file path by size.
Sort reverse reverseordering Optional Boolean Enable to sort the file path in reverse.
Position position Required Number Index in which the file is located in the defined directory.
File System fileSystem Optional File System Variable of connection with the file system, if it is blank, the file system of the operating system will be used.

Output parameter

Designer mode label Script mode name Accepted variable types Description
Path value Text Returns the file path

Example

The command gets the file path by name, returning the path as a log message.

defVar --name desktop --type String
defVar --name file --type BinaryFileWriter
defVar --name path --type String
// Obtém o caminho da pasta "Desktop".
getSpecialFolder --folder "Desktop" desktop=value
// A .txt file with name "file" is created in this folder.
openBinaryWriter --mode "CreateNew" --autoflush  --share "Write" --path "${desktop}\\file.txt" --encoding "Default" file=value
// The command gets path of this file, filtering by name.
getFilePath --path "${desktop}" --filemask file --position 1 path=value
// Logging the path.
logMessage --message "${path}" --type "Info"