Skip to main content

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 advanced file matching, making it useful for regular cleanup workflows including removing 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 are no longer needed, especially when those files follow naming patterns or reside in structured folders. This is useful for workflows that generate time-sensitive data such as daily exports, processed reports, or system logs.

This automation is helpful when cleanup actions need to 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, consider using the File Expiration feature instead. File Expiration allows Site Administrators to 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, or a connected child site. 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 flexible 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 be used to reflect folder hierarchy, such as %p1 or %p2, representing parent folders. These tokens allow you to build intelligent cleanup rules that adjust automatically based on timing or structure. This helps support 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 helps prevent file conflicts or race conditions on remote systems.

Get The File Orchestration Platform Today

4,000+ organizations trust Files.com for mission-critical file operations. Start your free trial now and build your first flow in 60 seconds.

No credit card required • 7-day free trial • Setup in minutes