DocsFileDelete File or Folder

Delete a file or folder automatically in RunMacro

Desktop ModeBrowser ModeRunMacro 3.5+

Delete File or Folder removes a path to the Recycle Bin or permanently, with an optional kind restriction and skip-when-missing.

Dialog & quick setup

RunMacro Delete File or Folder command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Delete File or Folder command in RunMacro.
  1. Add a File › Delete File or Folder command.
  2. Enter the path to delete.
  3. Choose the delete mode: Recycle Bin or Permanent.
  4. (Optional) Restrict the kind (file/folder), enable recursive for non-empty folders, and skip when missing. Save.

Options reference

Target path

The file or folder to delete. Supports variables.

Delete mode

recycle_bin (recoverable) or permanent (unrecoverable).

Target kind

file, folder, or any — guards against deleting the wrong kind.

Recursive

Allows deleting a non-empty folder (for permanent delete).

Missing OK

If on, does not error when the path is already gone.

Modes & when to use

Desktop Mode

Operates on the local file system.

Browser Mode

Best for

  • Clean temp files after processing.
  • Remove old output before creating new.
  • Drop a folder that is no longer needed.

Use an alternative when

  • You only want to delete files inside a folder by pattern — consider Delete Files.
Before you run
  • Delete permission at that location.
  • Recycle Bin mode needs the send2trash package.

Example workflow

Example: safely clean a temp file

  1. Delete: path {temp_file}, mode = Recycle Bin, Missing OK = on.
Expected result: The path is deleted per the chosen mode; the output variable holds the deleted path.

Tips & limitations

Permanent delete is unrecoverable. Prefer the Recycle Bin mode for bulk or still-testing runs.
The Recycle Bin mode needs the send2trash package; if missing, the command errors.
  • Permanent delete cannot be undone.
  • Non-empty folders need recursive enabled (for permanent delete).

Applies to RunMacro 3.5+ · Desktop Mode & Browser Mode · Windows 10/11

RunMacro robot

Robots do the work. Your time is yours.

Create a robot in minutes, no coding needed. Reliable execution, remote management, transparent costs — and you always stay in control.