Skip to content

Delete File

Type: delete-file  ·  Package: Filesystem Activities v1.0.6

Deletes a file. If the file does not exist, it does nothing (it does not fail). Use it to clean up temporary files, remove downloads already processed or free working space.

Deletes the file at path. If it does not exist, the activity carries on without error and logs a warning: File not found; nothing to delete. It is idempotent: safe to repeat or retry.

  • It only deletes files: if path points to a folder, it is not removed (treated as “not found”).
  • It does not accept wildcards: to delete several files, list them with List Files and delete each one.
ParameterTypeDefaultDescription
pathstring—Path of the file to delete.

None.

This activity does not return a value.

MessageCause and fix
The process cannot access the file '…' because it is being used by another process.The file is open in another program. Close it first, or retry with Retry and a delay.
Access to the path '…' is denied.No permission to delete, or the file is read-only.
'path' is required.The path expression evaluated to null.

Use a temporary file and delete it at the end:

Write File path = "C:/temp/work.txt" content = data → output: tempPath
... process ...
Delete File path = tempPath

Clear the .tmp files from a working folder:

List Files path = "C:/work" pattern = "*.tmp" → output: tempFiles
For Each items = tempFiles itemVariable = path
└─ activities:
Delete File path = path
  • Move File — archive instead of deleting.
  • File Exists — check first (although Delete does not fail if it is missing).