This workflow corresponds to n8n.io template #15079 — we link there as the canonical source.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "8jHMNBJ5qRZKo4P1",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Automated Dropbox Cleanup (Delete Files Older Than 48 Hours)",
"tags": [
{
"id": "xbOIfFbXqTsMi65g",
"name": "Delete",
"createdAt": "2026-04-09T16:14:23.875Z",
"updatedAt": "2026-04-09T16:14:23.875Z"
}
],
"nodes": [
{
"id": "2a77856e-597c-496e-9206-7b84e616667f",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
112,
64
],
"parameters": {
"rule": {
"interval": [
{
"daysInterval": 2
}
]
}
},
"typeVersion": 1.3
},
{
"id": "9e6e6e8d-298a-47eb-8a09-86d03be7aa38",
"name": "Query",
"type": "n8n-nodes-base.dropbox",
"position": [
512,
64
],
"parameters": {
"query": ".png",
"filters": {},
"resource": "search",
"returnAll": true,
"authentication": "oAuth2"
},
"credentials": {
"dropboxOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "291551d5-5281-4e8b-a435-d6869ea11909",
"name": "Code in JavaScript",
"type": "n8n-nodes-base.code",
"position": [
720,
64
],
"parameters": {
"jsCode": "const excludedPaths = [\n '/n8n icon.png',\n '/n8n icon(1).png'\n];\n\n// current time\nconst now = new Date();\n\n// 48 hours in milliseconds\nconst hours48 = 48 * 60 * 60 * 1000;\n\nreturn items\n .filter(item => {\n const name = item.json.name.toLowerCase();\n const path = item.json.path_lower;\n\n // file time (use server_modified or client_modified)\n const fileTime = new Date(item.json.server_modified || item.json.client_modified);\n\n const isOlderThan48hrs = (now - fileTime) > hours48;\n\n return (\n name.endsWith('.png') && // only png\n name !== 'admin_1.png' && // exclude Admin\n !excludedPaths.includes(path) && // exclude icons\n isOlderThan48hrs // \u2705 only older than 48 hrs\n );\n })\n .map(item => ({\n json: {\n path: item.json.path_lower\n }\n }));"
},
"typeVersion": 2
},
{
"id": "2cd35aec-f964-4352-88f7-be35e3a12438",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1184,
64
],
"parameters": {
"options": {}
},
"typeVersion": 3,
"alwaysOutputData": true
},
{
"id": "c654b7c7-56cc-4563-ba17-3bb5b81b530c",
"name": "Delete a file",
"type": "n8n-nodes-base.dropbox",
"position": [
1584,
160
],
"parameters": {
"path": "={{ $json.path }}",
"operation": "delete",
"authentication": "oAuth2"
},
"credentials": {
"dropboxOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "c7fd13c8-0366-4e0e-aa8c-b22d53c5562c",
"name": "\ud83d\udccb Workflow Overview",
"type": "n8n-nodes-base.stickyNote",
"position": [
-880,
-352
],
"parameters": {
"color": 4,
"width": 780,
"height": 744,
"content": "## Automated Dropbox Cleanup (Delete Files Older Than 48 Hours)\n\n### \ud83c\udfaf Overview\n\nKeep your Dropbox storage clean automatically by deleting .png files older than 48 hours, while protecting important files from removal.\n\n---\n### \u2699\ufe0f How It Works\n- Schedule Trigger \u2192 Runs every 2 days\n- Search Files \u2192 Finds all .png files in Dropbox\n- Smart Filter (Code) \u2192 Selects only: \n Files older than 48 hours\n Non-excluded filenames and paths\n- Batch Processing \u2192 Prevents rate limits\n- Delete \u2192 Removes files permanently\n\n---\n### \ud83d\udd27 Customization\n\nYou can easily adapt this workflow:\n\n- Change file age limit\nUpdate the time window inside the Code node\n- Target different file types\nReplace .png with .jpg, .mp4, etc.\n- Exclude more files/folders\nAdd paths or filenames to the exclusion list\n- Adjust schedule\nRun daily, hourly, or based on your needs\n\n---\n### \ud83d\udca1 Use Cases\n- Clean up AI-generated images automatically\n- Manage temporary or cached files\n- Prevent storage overflow in automation pipelines\n"
},
"typeVersion": 1
},
{
"id": "4b13e81b-58cc-46f5-9415-8c1b221ff009",
"name": "Section: Deduplication",
"type": "n8n-nodes-base.stickyNote",
"position": [
-32,
-352
],
"parameters": {
"color": 7,
"width": 444,
"height": 740,
"content": "### \ud83d\udfe8 Trigger Section (Near Schedule Trigger)\nReads already-used trends from the `trend_table` Data Table.\nFilters out any trend used in the **last 24 hours**.\nThen picks top 2 trends from what's left."
},
"typeVersion": 1
},
{
"id": "a6c30a8c-64a9-4110-b311-4f558b5ae95b",
"name": "Data Table Setup Tip",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
-208
],
"parameters": {
"color": 5,
"width": 380,
"height": 172,
"content": " **\u23f1 Trigger**\nRuns every 2 days to periodically clean up old files.\nYou can adjust the interval depending on how often files are generated."
},
"typeVersion": 1
},
{
"id": "b11a28cd-edd1-4081-a5a9-33b7e247c4e3",
"name": "Section: Deduplication1",
"type": "n8n-nodes-base.stickyNote",
"position": [
448,
-352
],
"parameters": {
"color": 7,
"width": 444,
"height": 740,
"content": "### \ud83d\udee0\ufe0f Filtering Logic (Code Node) \u2b50"
},
"typeVersion": 1
},
{
"id": "00b55d5f-73e5-4b10-bb4f-621c0a4448a4",
"name": "Data Table Setup Tip1",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
-208
],
"parameters": {
"color": 5,
"width": 380,
"height": 172,
"content": "**\ud83e\udde0 Filter Logic**\nKeeps only files that:\n\nAre .png files\nAre older than 48 hours\nAre NOT admin_1.png\nAre NOT in excluded paths (e.g., icons)"
},
"typeVersion": 1
},
{
"id": "3c98d929-3f47-4220-8aee-2493a4a0e598",
"name": "Section: Deduplication2",
"type": "n8n-nodes-base.stickyNote",
"position": [
960,
-352
],
"parameters": {
"color": 7,
"width": 988,
"height": 740,
"content": "### \ud83d\ude80 Loop / Processing and Deletion"
},
"typeVersion": 1
},
{
"id": "ba49c763-b74a-4f59-8d81-4e334a2d5b08",
"name": "Data Table Setup Tip2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1040,
-240
],
"parameters": {
"color": 5,
"width": 300,
"height": 204,
"content": "**\ud83d\udd01 Batch Processing**\n\nProcesses files one at a time to avoid API limits and ensure stable execution."
},
"typeVersion": 1
},
{
"id": "8d96eb23-c713-4796-88cf-fa3b9cd8aa22",
"name": "Data Table Setup Tip3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1456,
-224
],
"parameters": {
"color": 5,
"width": 300,
"height": 204,
"content": "**\u26a0\ufe0f Delete (Permanent Action)**\n\nThis action is permanent \u2014 test carefully before enabling.\n\n\ud83d\udd27 Customization\n\n- Change 48 hours in the Code node\n- Modify file type (.png \u2192 .jpg, .mp4)\n- Add more excluded files/paths\n- Adjust schedule frequency"
},
"typeVersion": 1
}
],
"active": true,
"settings": {
"timezone": "Africa/Lagos",
"binaryMode": "separate",
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": "7NR7A9As9QZPXVSL",
"timeSavedMode": "fixed",
"availableInMCP": false,
"executionOrder": "v1"
},
"versionId": "43dcaa50-a14c-4202-a554-a5a16c828d63",
"connections": {
"Query": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Delete a file": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Delete a file",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Query",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
dropboxOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow automatically scans your Dropbox for files and deletes any that are older than 48 hours, helping you keep your storage clean and organized without manual effort.
Source: https://n8n.io/workflows/15079/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This template is an interactive playground designed to help you master the most useful keyboard shortcuts in n8n and supercharge your building speed. Forget boring lists—this workflow gives you hands-
Workflow 2469. Uses moveBinaryData, googleDrive, itemLists, n8n. Scheduled trigger; 33 nodes.
Perfect for content publishing with organic scheduling patterns, social media automation, API systems that need to avoid rate limiting, or any automation requiring randomised timing control across mul
Complete backup solution that saves both workflows and credentials to local/server disk with optional FTP upload for off-site redundancy.
todoist automate. Uses todoist, executionData. Scheduled trigger; 27 nodes.