Every 15 minutes
Sort a OneDrive folder by file type
New files in your catch-all folder move into PDFs, Images or Other subfolders.
- Runs
- Every 15 minutes
- Apps
- OneDrive
- AI
- Not needed
- Access
- read+write
Send this to your assistant
Create a ClickRuntime automation: every 15 minutes, move new files in OneDrive Inbox into the subfolders PDFs, Images or Other based on file type.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A freelance designer's OneDrive Inbox folder gets everything: client PDFs, screenshots synced from a phone, Excel quotes, zipped assets, voice memos and a pile of JPGs named IMG_4821. Finding last quarter's proposal means searching through hundreds of unsorted files, and a rushed Friday afternoon cleanup never finishes. The mess slows every search and makes shared folders look unprofessional to clients.
Every 15 minutes, the contents of the inbox folder are listed, each file's extension is matched against a map (PDFs to Documents, JPG and PNG to Images, XLSX and CSV to Spreadsheets, MP3 and M4A to Audio, ZIP to Archives), and each file is moved to the matching subfolder by updating its parent folder in OneDrive.
It is a good fit for downloads folders, shared drop folders and scanned-document inboxes.
What you get out of it
Files are findable without searching
A predictable folder for each type means that browsing works. You know that quotes are in Spreadsheets, and you do not need to remember how a file was named. Searching by memory, by date or by a vague name becomes unnecessary because the folder itself narrows the search.
The cleanup never gets postponed
A manual sort is the sort of job that slips for months. Doing it every quarter hour keeps the inbox nearly empty, which means it always looks tidy. In a business where speed counts, a short search means a quicker reply to a client who is waiting.
Shared folders look professional
When clients or partners open a link to your drive, a folder of organized subfolders makes a better impression than a flat list of mixed files. That also saves you from the embarrassment of a client scrolling past your private screenshots to reach the folder they need.
Space problems are easier to spot
Once archives and videos sit in their own folders, it is simple to see which type consumes the most storage and to clear it out. A tidy structure also makes it easier to delete clutter confidently, since you can see what you have.
Less risk of misplaced documents
Contracts and invoices no longer vanish among screenshots, so important PDFs are in one predictable location when an audit or a deadline arrives. It saves the stressful minutes before a deadline, when you need that signed file and cannot find it.
How it works
What happens, step by step
Every 15 minutes, ClickRuntime checks your catch-all OneDrive folder for files.
It looks at each file's type: PDFs, images or anything else.
Each file is moved into the matching PDFs, Images or Other subfolder, so the folder stays tidy.
Before it runs live
- Connect OneDrive
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
- Act only on the items that match your own rules, and skip the rest
- 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 OneDrive steps into one automation
Under the hood
The code that runs this automation
from clickruntime import on_trigger, credentials, http, report_fetched
GRAPH = "https://graph.microsoft.com/v1.0"
INBOX = "Inbox"
TARGETS = {"PDFs": (".pdf",), "Images": (".jpg", ".jpeg", ".png", ".gif", ".heic")}
@on_trigger
def run(event):
h = {"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}
files = [i for i in http.get(f"{GRAPH}/me/drive/root:/{INBOX}:/children", headers=h).json()["value"] if "file" in i]
report_fetched(len(files))
if not files:
return {"summary": "Nothing new"}
folder_ids = {name: http.get(f"{GRAPH}/me/drive/root:/{INBOX}/{name}", headers=h).json()["id"] for name in [*TARGETS, "Other"]}
for f in files:
dest = next((name for name, exts in TARGETS.items() if f["name"].lower().endswith(exts)), "Other")
http.patch(f"{GRAPH}/me/drive/items/{f['id']}", headers=h, json={"parentReference": {"id": folder_ids[dest]}})
return {"sorted": len(files)}FAQ
Common questions
What happens to files with an unknown extension?
Does moving files break links that I shared?
Can it sort by sender or project name instead of 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
Hear when a file lands in a OneDrive folder
You get an email each time a new file appears in the folder you're watching.
See how it worksGet new PDFs in a folder summarised
Each PDF added to a folder reaches you as a short summary instead of a file to open.
See how it worksPull totals from invoices saved to OneDrive
Each invoice PDF dropped in a folder becomes a one-line email with supplier, date and total.
See how it worksKeep exploring
Set up “Sort a OneDrive folder by file type” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.