Use this robust n8n workflow to automatically clean up Cloudflare R2 (S3 compatible) buckets, deleting backups or files older than 14 days and sending confirmation notifications via Telegram. Essential n8n templates for DevOps.
Download this n8n workflow template and start using it instantly.
DevOps engineers needing automated data lifecycle management.
Users utilizing Cloudflare R2 or AWS S3 for long-term backup storage.
Administrators seeking confirmation alerts for cleanup tasks via Telegram.
Anyone looking for practical n8n templates for infrastructure maintenance.
Managing cloud storage costs and compliance often requires regularly deleting aged files. Manually performing these tasks can be tedious and prone to error. This solution provides a reliable, scheduled mechanism for data cleanup.
This specific n8n workflow acts as a cleanup agent, using the S3 API (compatible with Cloudflare R2) to list all objects. It then uses a custom n8n node to filter the list, retaining only files that are older than 14 days. Finally, it executes a batch delete operation and reports the outcome via Telegram.
By leveraging this n8n workflow, users can significantly reduce manual effort and ensure that their storage buckets are kept tidy, making this one of the most useful n8n templates for cloud operations.
The automated process begins with the Schedule Trigger n8n node.
LastModified date) from the designated Cloudflare R2 bucket.LastModified timestamp. It filters the dataset, passing only the items where the age exceeds 14 days (TWO_WEEKS).delete operation. For every item received, this n8n node executes a corresponding delete command using the file's Key.To deploy this n8n workflow, follow these steps:
bucketName parameter in both S3 n8n nodes to match your actual bucket.chatId to the specific group or user you wish to receive notifications. Schedule Trigger n8n trigger:
Function: Starts the n8n workflow daily at the configured hour (9 AM).
Key Configuration: triggerAtHour is set to 9.
S3 (List) n8n node:
Function: Connects to the cloud storage (Cloudflare R2 or AWS S3) and retrieves metadata for all objects within the specified bucket.
Key Configuration: Operation: getAll, Return All: true, Credentials: Cloudflare S3 account.
Code n8n node:
Function: Filters the file list based on age. It calculates if the LastModified date is older than 14 days (14 24 60 60 1000 milliseconds).
Key Configuration: Custom JavaScript logic defining the TWO_WEEKS constant and filtering objects accordingly.
S3 (Delete) n8n node:
Function: Deletes the specific file keys passed down from the filtering step.
Key Configuration: Operation: delete, File Key: ={{ $json.Key }} (uses data passed from the previous n8n node).
Telegram n8n node:
Function: Sends a confirmation message after a file has been successfully removed.
* Key Configuration: Text: Includes interpolation of the deleted file key ({{ $('Code').item.json.Key }}) for clear reporting.
Use this robust n8n workflow to automate the monthly cleanup of your Gmail Spam folder. This n8n template uses the Schedule n8n trigger and Gmail n8n node for guaranteed mailbox hygiene and storage savings.

Automate SOC triage by using this powerful n8n workflow. It reads security alerts from Google Sheets, classifies them using GPT (via HTTP Request n8n node), and updates the sheet automatically.

Automate WordPress content taxonomy using an AI expert agent. This powerful n8n workflow retrieves all posts, categorizes them using OpenAI, and updates categories instantly, utilizing crucial n8n templates.

Use this powerful n8n workflow to search Reddit for brand mentions, analyze relevance using dual AI agents (Gemini/Anthropic), post non-promotional comments, and track every interaction in Baserow.

Automate document conversion with this n8n workflow. Triggered by a new Word file in OneDrive, it uses Foxit PDF Services to convert it to PDF and emails the result via Gmail.









































