Skip to content

Every 6 hours

Clear out old exports automatically

Files of the type you name are deleted once they pass the age you set, and you get a count.

Runs
Every 6 hours
Apps
Dropbox
AI
Not needed
Access
files.content.write

Send this to your assistant

Create a ClickRuntime automation: every 6 hours, delete .png files in my Dropbox /Exports folder that are older than 48 hours, and email me how many were removed.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

Some Dropbox folders are meant to be temporary: exported reports, weekly database dumps, client preview files, screen recordings. They pile up for years, eating into storage quota, and old files that nobody remembers include data you would rather not keep. Cleaning them manually means opening folders, sorting by date and deleting carefully, which never feels urgent until the account is full.

Every six hours the automation lists the folder you named, keeps files of the extension you named that were last modified before your cutoff, deletes them and emails you how many were removed. Old files disappear on schedule, while recent ones and other file types are left alone, so the cleanup needs no attention from you.

Agencies, teams that share temporary exports and anyone who pays for Dropbox storage will appreciate it.

What you get out of it

  • Storage costs stay under control

    Removing expired exports keeps you under your storage limit, which can delay the need for a larger and more expensive plan. Space is reclaimed continuously, not in a panicked cleanup once the account is full.

  • Sensitive files do not linger

    Old exports containing customer data are removed after a set time. That supports a sensible retention policy without anyone having to remember to enforce it, which is the part that usually fails in practice.

  • Folders stay easy to use

    A folder with only recent files is quick to scan. People stop picking the wrong old version by accident, and a newcomer sees at a glance what is current instead of wading through years of leftovers.

  • Only the files you intend

    Filtering by extension and age means a kept contract PDF in the same folder is not touched while temporary files are removed. Rules are explicit and predictable, so nothing is deleted on a hunch.

  • Proof the cleanup ran

    The email reports the count deleted at each run, so you can see the schedule is working. If the number suddenly jumps or drops to zero, that is a signal worth looking at before storage fills up.

How it works

What happens, step by step

  1. Every 6 hours, ClickRuntime looks through your Dropbox folder.

  2. It picks out files of the type you chose, such as PNGs, that are older than your cutoff.

  3. Those files are deleted.

  4. You get an email with how many files were removed and their names.

Before it runs live

  • Connect Dropbox

What you get

RunsEvery 6 hours
Clear out old exports automaticallytoday, 9:00Succeeded
Email · Removed 14 old PNGs from /Exportschart-2026-10-16-0900.png chart-2026-10-16-1500.png

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Dropbox steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
delete_old_files_on_a_schedule.pyexample
from datetime import datetime, timedelta, timezone
from clickruntime import on_trigger, notify, http, credentials

@on_trigger
def run(event):
    auth = {"Authorization": "Bearer " + credentials.connection("dropbox", "main")}
    entries = http.post("https://api.dropboxapi.com/2/files/list_folder", headers=auth, json={"path": "/Exports"}).json()["entries"]
    cutoff = datetime.now(timezone.utc) - timedelta(hours=48)
    old = [e for e in entries if e[".tag"] == "file" and e["name"].lower().endswith(".png")
           and datetime.fromisoformat(e["server_modified"].replace("Z", "+00:00")) < cutoff]
    if not old:
        return {"deleted": 0}
    http.post("https://api.dropboxapi.com/2/files/delete_batch", headers=auth,
              json={"entries": [{"path": e["path_lower"]} for e in old]}).raise_for_status()
    notify.email_me(f"Removed {len(old)} old PNGs from /Exports", "\n".join(e["name"] for e in old))
    return {"deleted": len(old)}

FAQ

Common questions

Are deleted files gone for good?
Dropbox keeps deleted files in its deleted files area for a period set by your plan, so they can usually be restored within that window. After that they are removed for good, so choose the age cutoff with care.
Can it clean several folders?
Yes. Each folder you name is checked using its own file type and age rule, and the email lists counts for each. That lets you keep exports for a week while keeping recordings for a month.
How is the age of a file measured?
It uses the server modified time that Dropbox records, which is when the file was last changed or uploaded. A file that is edited again gets a new date and therefore stays in the folder longer.
What permissions does it need?
files.content.write. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (every 6 hours). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Clear out old exports automatically” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.