Delete File
Verb: fileDelete
Deletes a file from a directory permanently.
Syntax
fileDelete --file(String) [--fileSystem(FileSystem)]
Inputs
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. |
Example
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.