Delete File

Verb: fileDelete

Deletes a file from a directory permanently.


fileDelete --file(String) [--fileSystem(FileSystem)]


Script Designer Required AcceptedTypes Description
--file File Path Required Text Full path of the file to be deleted.
--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: IBM RPA Control Center.
2. If nothing is specified in this parameter, the local file system of the operating system is used as default.


The command is executed to delete a file from the "exampleDeleteFile" directory.

defVar --name documentsPath --type String
defVar --name filesFolder --type String
defVar --name fileToDelete --type String
// Prepare the directory with the file to be deleted.
getSpecialFolder --folder "MyDocuments" documentsPath=value
createDir --path "${documentsPath}\\exampleDeleteFile" filesFolder=value
writeToFile --value "File to be deleted" --file "${filesFolder}\\fileToDelete.txt" --overwrite  fileToDelete=value
// Deletes the file "fileToDelete.txt" from the folder "exampleDeleteFile".
fileDelete --file "${fileToDelete}"
// After the script was executed, the file "fileToDelete.txt", which existed in the folder "exampleDeleteFile", was deleted.

See Also

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