Weekly
Get a weekly Drive cleanup report in Slack
Every Monday you see the duplicate files, old backups and long-untouched files in your Drive, so cleanup takes minutes.
- Runs
- Weekly
- Apps
- Google Drive, Slack
- AI
- Not needed
- Access
- Drive read; Slack chat:write
Send this to your assistant
Create a ClickRuntime automation: every Monday, scan my Drive folders for duplicate files, backups older than 7 days and files nobody has touched for a year, and post the report to #it.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A ten-person agency keeps everything in a shared Drive. Over two years it has filled with copies of the same logo pack, nightly export backups nobody deletes, and project folders from clients who left long ago. Storage keeps running out and nobody knows where to start.
A short weekly report turns cleanup into a habit. The person looking after IT sees exactly which files are duplicates or stale and can clear them in one sitting, instead of buying more storage.
What you get out of it
Storage stays under control
Duplicates and forgotten backups are usually the biggest wasters of space. Seeing them every week stops the slow creep towards a full Drive.
Cleanup has a clear list
Instead of browsing folders and guessing, you get the file names to look at. Deleting the obvious ones takes minutes.
Old files get a second look
Files nobody has opened for a year are often outdated versions that cause confusion. The report prompts a decision to archive or remove them.
It happens without a reminder
The report arrives every Monday whether or not anyone remembers. Good Drive habits stop depending on one person's calendar.
How it works
What happens, step by step
Every Monday, ClickRuntime looks through the files in your Google Drive.
It finds files with identical content, backups older than seven days and files nobody has changed in a year.
It groups them into a short report with the file names.
The report is posted in your #it Slack channel.
Before it runs live
- Connect Google Drive
- Connect Slack, then invite the app to the channel (type /invite @ClickRuntime there)
What you get
Build your own
Need it to work differently?
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 Google Sheets
- Combine it with other Google Drive and Slack steps into one automation
Under the hood
The code that runs this automation
from collections import defaultdict
from datetime import datetime, timedelta, timezone
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, notify
@on_trigger
def run(event):
drive = build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
now = datetime.now(timezone.utc)
files, token = [], None
while True:
page = drive.files().list(q="trashed=false and mimeType!='application/vnd.google-apps.folder'", pageToken=token,
fields="nextPageToken,files(name,md5Checksum,modifiedTime)", pageSize=1000).execute()
files += page.get("files", [])
token = page.get("nextPageToken")
if not token:
break
by_sum = defaultdict(list)
for f in files:
if f.get("md5Checksum"):
by_sum[f["md5Checksum"]].append(f["name"])
dups = [names for names in by_sum.values() if len(names) > 1]
age = lambda f: now - datetime.fromisoformat(f["modifiedTime"].replace("Z", "+00:00"))
backups = [f["name"] for f in files if "backup" in f["name"].lower() and age(f) > timedelta(days=7)]
stale = [f["name"] for f in files if age(f) > timedelta(days=365)]
notify.slack(f"Drive report: {len(dups)} duplicate sets, {len(backups)} old backups, {len(stale)} files untouched for a year.\n"
+ "\n".join(" = ".join(d) for d in dups[:20]), channel="#it")
return {"duplicates": len(dups), "backups": len(backups), "stale": len(stale)}FAQ
Common questions
How does it spot duplicate files?
Does it delete anything?
What counts as a backup?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Merge daily CSV exports in Drive into one clean master file
Each evening the day's CSV exports are combined into one deduplicated file in Drive, and your team sees row counts and problems in Slack.
See how it worksFile new invoices in Drive and tell finance in Slack
Every invoice that arrives by email lands in your Drive Invoices folder, and #finance gets a daily list with links.
See how it worksWrite a weekly AI brief, save it as a PDF in Drive and share it in Slack
Every Monday a written brief from your notes lands in Drive as a PDF, with the link posted in your Slack channel.
See how it worksKeep exploring
Set up “Get a weekly Drive cleanup report in Slack” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.