Automate Your Daily Tasks with Python

Rename files, clean folders and send reports automatically with a short Python script.

By Dr. Dev2026-01-106 min read
🐍

Why automate?

Repeating the same five-minute job every day adds up to hours. A small script removes the repetition and the mistakes that come with it.

A folder cleaner in 12 lines

This script sorts downloads into folders by file type.

from pathlib import Path
import shutil

src = Path.home() / 'Downloads'
for f in src.iterdir():
    if f.is_file():
        dest = src / (f.suffix.lstrip('.') or 'misc')
        dest.mkdir(exist_ok=True)
        shutil.move(str(f), dest / f.name)

Next step

In part 2 we schedule this script so it runs without you.

Related articles