Hourly or daily
Keep your uploads folder sorted
New files get a dated name and move into folders by type, and duplicates are reported to you.
- Runs
- Hourly or daily
- Apps
- Google Drive
- AI
- Not needed
- Access
- read+write (drive)
Send this to your assistant
Create a ClickRuntime automation: every hour, rename new files in my Inbox folder to YYYY-MM-DD_name, move PDFs, images and docs into matching subfolders, and email me any duplicates by name and size.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
An uploads folder shared by a whole office slowly turns into a dumping ground. Scanned receipts arrive as IMG_4821.jpg, the same contract is saved three times with slightly different names, and PDFs, spreadsheets and photos all sit in one flat list. Finding last quarter's supplier invoice means scrolling through hundreds of files, and storage fills with copies nobody can safely delete.
On the schedule you pick, hourly or daily, ClickRuntime lists the files in the folder and works out a new name and destination for each. Names get the file's date, files are moved into folders by type using Drive's addParents and removeParents, and files with the same md5Checksum are collected into a report so you can decide which copy to remove.
It works best as a shared inbox folder that people use without thinking about naming rules.
What you get out of it
Files you can find by date
A date at the start of each name makes a folder sort chronologically. Looking for something from August takes seconds, and nobody has to open a dozen files called scan1 to find the right one.
Fewer wasted gigabytes
Matching md5Checksum values identify identical content even when the names differ. Removing true copies reclaims space and avoids paying to store the same video or archive several times over, which adds up quickly on shared drives.
Staff keep their own habits
People can keep dropping files in without learning a naming convention. The tidy-up happens afterward, so the system works even for the colleague who never reads the shared guidelines or the pinned instructions.
Duplicates reviewed by a person
Nothing is deleted automatically. A report lists the copies together, so someone confirms which version is the original before anything is trashed, which avoids accidental loss of a file that only looked identical.
A sorted archive for audits and handovers
When a team member leaves or an auditor asks for documents, a folder organized by type and date can be handed over as it is, instead of needing a week of cleanup first.
How it works
What happens, step by step
Every hour or day ClickRuntime looks at the files in your Google Drive uploads folder.
It moves each file into the right subfolder by type, such as PDFs, images or documents.
It checks for files that are exact copies of each other.
If it finds any, you get an email listing each duplicate and how many copies there are.
Before it runs live
- Connect Google Drive
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 Slack
- Combine it with other Google Drive steps into one automation
Under the hood
The code that runs this automation
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from collections import defaultdict
from clickruntime import on_trigger, credentials, notify
INBOX = "inbox-folder-id"
SUBFOLDERS = {"pdf": "pdfs-folder-id", "image": "images-folder-id", "doc": "docs-folder-id"}
def kind(mime):
if mime == "application/pdf":
return "pdf"
if mime.startswith("image/"):
return "image"
return "doc" if "document" in mime or "word" in mime else None
@on_trigger
def run(event):
drive = build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
files = drive.files().list(q=f"'{INBOX}' in parents and trashed = false",
fields="files(id,name,mimeType,size,createdTime)").execute()["files"]
groups = defaultdict(list)
for f in files:
groups[(f["name"], f.get("size"))].append(f["name"])
name = f["name"] if f["name"][:4].isdigit() else f"{f['createdTime'][:10]}_{f['name']}"
target = SUBFOLDERS.get(kind(f["mimeType"]))
drive.files().update(fileId=f["id"], body={"name": name}, addParents=target,
removeParents=INBOX if target else None).execute()
dupes = [f"{name} ({size} bytes) x{len(v)}" for (name, size), v in groups.items() if len(v) > 1]
if dupes:
notify.email_me(f"{len(dupes)} duplicate files in Inbox", "\n".join(dupes))
return {"sorted": len(files), "duplicates": len(dupes)}FAQ
Common questions
How does it tell that two files are duplicates?
Will moving files break links people have shared?
Can files be sorted by something other than type?
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
Back up your data to Drive every night
Each night your data is saved to a dated Drive folder, and backups older than 30 days go to trash.
See how it worksArchive a website to Drive as Markdown
Each page of a site is saved in Drive as a Markdown file you can read or reuse.
See how it worksCopy new SFTP files into Drive
New files on your FTP or SFTP server are copied into Drive every hour.
See how it worksKeep exploring
Set up “Keep your uploads folder sorted” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.