If File Exists

Verb: ifFile

Checks for the existence of a file following a specified file path.


ifFile --file(String) [--fileSystem(FileSystem)] (Boolean)=value


Script Designer Required AcceptedTypes Description
--file File Path Required Text Full path of the file that should be checked.
--fileSystem File System Optional File System File system connection variable.
1. To obtain the connection variable with 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 operating system's local file system is used by default.


Script Designer AcceptedTypes Description
value Result Boolean Returns a boolean that ratifies or denies the existence of the file specified in the File Path parameter, assigning "True" to indicate the existence of the file, or "False" to indicate its absence.


A directory called "fileFolder" is prepared, containing a file named "verifiedFile.txt". Then, the command If File Exists is used to check if the file exists, informing its path.

defVar --name documentsPath --type String
defVar --name fileFolder --type String
defVar --name verifiedFile --type String
defVar --name fileExist --type Boolean
getSpecialFolder --folder "MyDocuments" documentsPath=value
createDir --path "${documentsPath}\\fileFolder" fileFolder=value
writeToFile --value "Verified File!!." --file "${fileFolder}\\verifiedFile.txt" --overwrite  verifiedFile=value
// Checks whether the previously prepared folder file exists.
ifFile --file "${verifiedFile}" fileExist=value
logMessage --message "File Exist: ${fileExist}" --type "Info"
// After executing the script, the following result is obtained:
// File Exist: True.

See Also

  • Check If Directory Exists
  • Convert Base64 to File
  • Convert File to Base64
  • Copy File
  • Count Files
  • Create Directory
  • Delete Directory
  • Delete File
  • Delete from Directory
  • Download from File System
  • Get Directories
  • Get Files
  • Move File
  • Read All Bytes
  • Read All Text
  • Rename File
  • Send to File System
  • Write to File