Skip to content

delete-file ​

Remove a selected file, directory, or symlink with an explicit trash and recursion policy.

When to use it ​

Use this node only when cleanup is part of the reviewed workflow. Avoid broad generated paths or unreviewed directory targets.

Example ​

rattish
Rattish: 1

Workflow:
  name: Delete a resource

Node step:
  type: delete-file
  path: scratch/obsolete.txt
  use-trash: true
  missing-ok: true
  recursive: false
  finish: pass

Trash is enabled by default. Set use-trash: false only for deliberate permanent deletion. recursive defaults to false, and missing-ok defaults to false. This example allows an already absent temporary file.

Output distinguishes trashed, deleted, and missing, and includes a trash path when applicable. Do not assume every platform or runtime has usable trash storage.

Configuration ​

Configuration fields use hyphens. These are the node-specific fields; shared execution fields apply separately.

FieldTypeRequired / defaultMeaning
pathstringRequiredTarget filesystem path.
use-trashbooleantrueUse trash rather than permanent removal.
recursivebooleanfalsePermit recursive operation.
missing-okbooleanfalseAllow an absent target.

Inputs and output ​

This node has no declared input ports. Configure its authored fields directly.

Successful output fields use these exact selector names:

FieldValue type
pathstring
path_kindfile, directory, symlink, missing
dispositiontrashed, deleted, missing
trash_pathstring or null

For example, refer to node.step.output.path from a compatible downstream binding.

Preflight and limits ​

The target must satisfy the missing/recursive policy, and trash must be available when requested. When the node has needs, preflight skips the existence check because an upstream step may create the target earlier in the run; the node then reports a missing target when it runs. Stop or a downstream failure does not undo deletion.

Use Raticode rattish check and Raticode rattish preflight before choosing to run the example. The installed contract is available through Raticode rattish docs --format json.

Continue with Node reference, Routes and joins, or Runs and approvals.