How to automatically sort files into folders

To sort files into folders automatically, decide on your folder structure first, then use a tool that applies rules to every file — such as a script, a rules-based utility or an instruction-based app like Sortem. Always preview the result before files move, and keep a way to undo it.

Step 1: Decide the structure before you automate it

Automation only helps if it knows where files should go. Write down the top-level folders you want and how files inside them should be grouped — for example by client, by year or by document type. Keep it shallow: two or three levels is usually enough.

  • Pick one main way to group files (client, project, property or year).
  • Add a small number of subfolders that repeat inside each group.
  • Include an Unsorted folder for anything that doesn't fit, so nothing is lost.

Step 2: Choose a method

Option A: Sort and group in File Explorer

In File Explorer you can sort by Type or Date modified, select a block of files and drag them into a folder. It's free and needs no setup, but it's manual and slow for large folders.

Option B: A script

A PowerShell script can move files by extension or date. This is fully automatic, but you need to be comfortable writing and testing code, and a mistake can move many files at once.

Option C: An instruction-based app

Apps such as Sortem let you describe the result in plain English — “sort invoices by year and supplier” — and build a plan for you to review before anything moves.

Step 3: Test on a copy first

Whatever method you use, try it on a copy of a small folder before running it on important files. Check a handful of files ended up where you expected.

Step 4: Keep new files sorted

Sorting once is only half the job. Set up a routine (a weekly clean-up) or a tool that watches a folder such as Downloads and files new items as they arrive.

Frequently asked questions

Related guides