Delete Files
The Delete Files automation permanently removes files from a selected folder path. It can run on a schedule, respond to file action based triggers, or be initiated via an inbound webhook. The automation supports file matching for cleanup workflows that remove temporary files, outdated reports, expired data, or logs that are no longer needed.
When to Use Delete Files Automation
Use the Delete Files automation when you need to regularly remove files that follow naming patterns or reside in structured folders. This fits workflows that generate time-sensitive data such as daily exports, processed reports, or system logs.
The automation also fits cleanup actions that respond to specific events, target certain files while excluding others, or operate across multiple folders with logic tied to folder structure or timestamps.
If your use case only requires removing files based on age and does not need pattern matching or trigger-based execution, use the File Expiration feature instead. File Expiration lets Site Administrators set rules on a per-folder basis that automatically remove unmodified files after a specified number of days, while preserving the folder structure. Use Delete Files automation when you need more selective or event-driven control over file removal.
Source Path and Folder Selection
The source path can be a folder on the main site, a remote server, a connected child site, or a Workspace. You can use wildcards like /* to target top-level subfolders or /** to target all subfolders. For example, invoices/* selects only folders directly beneath invoices, while invoices/** targets all folders under that path, at any depth.
When the source is a Mounted Folder or Remote Server, automations that include glob patterns like * or ** in the source path are supported only when triggered by file action based triggers.
File Matching Rules
You can apply a file name pattern to include only certain files for deletion. Use wildcard expressions such as *.pdf or **/*.log to match specific formats or patterns. If no pattern is specified, all files in the selected folder path are eligible for deletion. This makes it easy to remove files such as daily logs, reports, or processed exports that are no longer needed.
You can also define an exclude pattern to skip files you do not want deleted. For example, **/*draft* skips any file containing the word "draft" in its name. Wildcards support inclusion and exclusion logic to refine your deletion scope.
Pattern Tokens and Dynamic Matching
File name patterns can include dynamic time-related tokens such as %Y, %m, or %d to match files based on when the automation runs. These tokens can reflect date, time, or folder structure, such as the day of the year or the hour of execution. For example, a pattern like %Y-%m-%d-report.csv matches a file named with that day's date.
Source path related tokens can also reflect folder hierarchy, such as %p1 or %p2, which represent parent folders. These tokens let you build cleanup rules that adjust automatically based on timing or structure. This supports workflows like removing monthly exports, deleting shift-based logs, or cleaning up stale files under structured directories.
Files deleted by this automation are permanently removed.
Controlling How Delete Files Automations Are Executed
When triggered by file action based triggers or inbound webhooks, Delete Files automations run in parallel when multiple events occur in close succession. This improves performance but can introduce file conflicts or race conditions when working with Remote Mounts.
Enable the Always Serialize Jobs setting to force the automation to run one job at a time. This prevents file conflicts and race conditions on remote systems.