Skip to content

Delete File Function: deletefile

The Delete File function is used to delete a specific file with a given extension. It ensures that unnecessary or outdated files are removed from the system as part of an automation workflow.

Example: You want to delete a log file (error.log) from the system and store the result in a variable for further validation.

Steps to Configure:

  1. Select SET from the Action dropdown.
  2. In the Element Key field, enter a variable name to store the output (e.g., DeleteStatus).
  3. In the Parameter section, click Form and select Functions from the dropdown.
  4. Choose Delete File from the list of functions.
  5. In the Cmd filed, select delete.
  6. Enter the file path of the file you want to delete in the File field (e.g., C:/Logs/error.log).
  7. Click Save.

Note: While the steps for adding a command are identical in both views, the display of the steps changes:

scrn-delete-file
Tabular View
scrn-delete-file-card-view
Card View

Expected Outcome

  • If the file is deleted successfully, the variable defined in the Element Key (e.g., DeleteStatus) will store true.
  • If the file deletion fails (e.g., file not found, permission issues), the variable will store false.
  • This variable can be used in subsequent steps for verification or error handling using the syntax ${VariableName} (e.g., ${DeleteStatus}).

Back To Top