Section 1: Automation foundations
What is worth automating
Not every task should be automated. A good candidate has three properties: it is repetitive, it follows clear rules, and doing it by hand is slow or error prone. Renaming 400 photos by date fits all three. Writing a thoughtful reply to a client does not.
A useful way to decide is to estimate how long the task takes each time, how often you do it and how long a script would take to write. If you rename files for ten minutes every week, a script that takes two hours to write pays for itself in about three months, and it never makes a typo.
Typical tasks we will cover
- Sorting downloads into folders by file type
- Renaming files with a consistent date based pattern
- Merging monthly spreadsheets into one summary
- Checking a website or API for new information
- Filling the same web form with data from a spreadsheet
- Emailing a report every Monday morning
The shape of a good script
Every script in this course follows the same structure:
- Inputs at the top: folder paths, file names and settings in clearly named variables or command line arguments.
- A dry run mode that prints what would happen without changing anything.
- The work, split into small functions.
- Logging that records what was done.
- Clear errors when something unexpected happens, instead of silently continuing.
This shape makes scripts safe to run and easy to change later. It also means you can hand a script to a colleague without a long explanation.
A word on safety
Scripts are fast, and that includes making mistakes fast. Before running anything that moves or deletes files, test it on a copy of the folder. Always start with the dry run. We will build this habit in the very first project.
In the next lesson we set up a tidy workspace with uv, so every script knows exactly which packages it needs.