Free

Automatic File Organizer

A tool that moves your files has to show you what it will do before it does it.

  • Python

About this project

A script that sorts a messy folder — Downloads, a project folder, a phone dump — into subfolders by file type. Standard library only, so there is nothing to install.

The idea it is built around is that a tool which moves a person's files must show them what it will do first. Running it prints a plan and moves nothing; actually moving anything requires an explicit `--apply`. That is the whole safety model, and it is one flag.

Beyond that it handles the two things naive versions get wrong. Name collisions: two files called report.pdf from different folders do not overwrite each other, the second becomes "report (2).pdf". And the fact that os.rename raises OSError when the destination is on a different drive while shutil.move quietly copies and deletes instead — a difference that only shows up on the day someone organises a folder onto another disk. Nothing is ever deleted.

What you will learn

  • Make the safe thing the default: a dry run that requires an explicit flag to act
  • Handle name collisions without ever overwriting a file
  • Know when os.rename fails and shutil.move does not, and why
  • Walk a directory tree with pathlib and classify files by extension
  • Write a command-line tool that refuses clearly instead of failing obscurely

Before you start

  • Python basics — functions, loops and dictionaries
  • Python 3.10 or newer. Standard library only.

New to Python? The free Python course covers everything this project assumes.

Academic integrity notice

These projects are provided for learning, experimentation and reference. Understand the code, modify it for your own requirements, and acknowledge external work according to your institution’s academic policies. Priodemy does not supply work to be submitted as your own.