25 Python Scripts to Automate Your Daily Tasks
25 Python Scripts to Automate Your Daily Tasks
A must-have collection for every developer
Follow
8 min read
·
Sep 12, 2025
1
Share
Press enter or click to view image in full size

Image Generated using Ideogram
If you’ve been writing Python long enough to suffer from repetitive clicking and copy-pasting, this is for you: 25 compact, battle-tested scripts that automate real daily friction — not toy examples that live forever in a gist. Each snippet below is copy-pasteable, opinionated (because defaults matter), and comes with a short pro tip so you can move from experiment to reliable automation fast. Expect receipt OCR that files itself, calendar-aware wallpapers that actually help you focus, safe duplicate cleaners, local semantic search for your notes, and other tiny tools that save hours. Read one, run one, ship one — that’s how you get your time back.
1) Smart Downloads Organizer — content-aware folders
Automatically sorts downloads into folders based on MIME type + file content hints (images, invoices, installers).
# requires: python-magic, pillow
import os, shutil, magic
from PIL import Image
SRC = "/path/to/Downloads"
for name in os.listdir(SRC):
p = os.path.join(SRC, name)
if not os.path.isfile(p): continue
m = magic.from_file(p, mime=True)
if m.startswith("image/"):
dest = os.path.join(SRC, "Images")
elif "pdf" in m or name.lower().endswith(('.pdf','.docx','.txt')):
dest = os.path.join(SRC, "Documents")
else:
dest = os.path.join(SRC, "Misc")
os.makedirs(dest, exist_ok=True); shutil.move(p, os.path.join(dest, name))
print("Moved", name, "->", dest)
Pro tip: run as a cron/Task Scheduler job; use a lockfile to avoid race conditions.
2) Duplicate File Detective — hashing + heuristics
Find duplicates by size → partial hash → full hash to avoid reading whole file when unnecessary.
import os, hashlib
from collections import defaultdict
def hash_partial(f, n=4096):
with open(f,'rb') as fh:
return hashlib.md5(fh.read(n)).hexdigest()
by_size = defaultdict(list)
for root,_,files in os.walk("/path/to/scan"):
for f in files:
p = os.path.join(root,f); s = os.path.getsize(p)
by_size[s].append(p)
for size, files in by_size.items():
if len(files) < 2: continue
hashes = {}
for p in files:
h = hash_partial(p)
if h in hashes: print("Partial dup:", p, "==", hashes[h])
else: hashes[h]=p
Pro tip: present duplicates to user before deleting; keep a safe trash folder.
3) Auto OCR + Receipt Router — scan receipts & categorize
Drop a photo into a folder; script OCRs, extracts totals, date, vendor, and moves to expense folder.
# requires: pytesseract, pillow, dateparser
import os, re, shutil, pytesseract
from PIL import Image
import dateparser
SRC="/path/to/incoming_receipts"
for f in os.listdir(SRC):
p=os.path.join(SRC,f)
txt=pytesseract.image_to_string(Image.open(p))
total = re.search(r'(?i)(total|amount)\s*[:\s]\s*([$€£]?[\d.,]+)', txt)
date = dateparser.search.search_dates(txt)
folder = "Uncategorized"
if total: folder = "Expenses"
os.makedirs(folder, exist_ok=True); shutil.move(p, os.path.join(folder,f))
print(f, "->", folder, "total:", total.group(2) if total else "N/A")
Pro tip: tune OCR preprocessing (grayscale, threshold) for better extraction.
4) Meeting Notes Summarizer — transcript → highlights → action items
Take meeting transcript (audio→whisper/transcript) and auto-summarize and extract action items.
# pseudocode: requires openai/whisper or local ASR + transformers summarizer
from transformers import pipeline
summarizer = pipeline("summarization")
with open('transcript.txt') as f: txt=f.read()
summary = summarizer(txt, max_length=120, min_length=30)[0]['summary_text']
print("Summary:\n", summary)
Pro tip: chunk long transcripts before summarizing; then aggregate key sentences and run simple regex for verbs + person names to extract action items.
5) Slack Digest Bot — push highlights to Slack daily
Scan starred emails / top GitHub PRs / important logs and send a single Slack digest.
# requires: slack_sdk
from slack_sdk import WebClient
client = WebClient(token="xoxb-your-token")
summary = "1) 3 new PRs\n2) Billing alert\n3) Meeting at 15:00"
client.chat_postMessage(channel="#daily-digest", text=summary)
Pro tip: batch content and rate-limit posts; provide “read more” links to long content.
6) Auto-commit Message Generator — describe your git diff in plain English
Use git + simple diff summarization to generate decent
commit messages.
import subprocess, textwrap
diff = subprocess.check_output(['git','diff','--staged','--name-status']).decode()
title = diff.splitlines()[0] if diff else "chore: minor updates"
desc = subprocess.check_output(['git','diff','--staged']).decode()[:500]
message = f"{title}\n\n{desc}"
print(message
Pro tip: integrate with a lightweight model or regex rules to convert added/removed files into a tidy subject line.
7) Auto-Tag Photos with Faces & Scenes — privacy-first local tagging
Detect faces and dominant labels (beach, office) and add tags to filenames or EXIF.
# requires: face_recognition, torchvision (or use opencv + pretrained)
import face_recognition, os
for img in os.listdir("photos"):
path=os.path.join("photos",img)
img_arr = face_recognition.load_image_file(path)
faces = face_recognition.face_locations(img_arr)
tags = []
if faces: tags.append("people")
# naive label: filename rename
if tags: os.rename(path, os.path.join("photos", f"{tags[0]}_{img}"))
Pro tip: store face encodings locally and allow opt-in for personal contacts only.
8) Auto-Archive Old Files — mailbox/disk housekeeping
Move files older than N days to cold storage (or cloud) and log actions.
import os, shutil, time
THRESH=30*24*3600
SRC="/path/to/data"; ARCH="/path/to/archive"
now=time.time()
for root,_,files in os.walk(SRC):
for f in files:
p=os.path.join(root,f)
if now - os.path.getmtime(p) > THRESH:
os.makedirs(ARCH, exist_ok=True); shutil.move(p, os.path.join(ARCH,f))
print("Archived", f)
Pro tip: keep a small index file (CSV) of moved items for easy restore.
9) Auto-Backup Local Databases (SQLite → Remote)
Take point-in-time SQLite snapshots, compress, and push to S3/remote server.
import sqlite3, shutil, tarfile
DB="my.db"; snapshot="snap.db"; tar="backup.tar.gz"
shutil.copyfile(DB, snapshot)
with tarfile.open(tar,"w:gz") as t: t.add(snapshot)
print("Snapshot archived:", tar)
Pro tip: use PRAGMA wal_checkpoint before copy to ensure
consistency for WAL mode.
10) Calendar-aware Wallpaper (your desktop reflects your day)
Change wallpaper automatically based on calendar events (focus, meeting, weekend).
# pseudocode: needs platform-specific wallpaper set; use google-calendar API for events
if next_event_type=="meeting": set_wallpaper("focus.jpg")
elif day_of_week in (5,6): set_wallpaper("weekend.jpg")
else: set_wallpaper("default.jpg")
Pro tip: use local heuristics (e.g., >30min meeting in next hour → focus wallpaper) not exact titles for privacy.
11) Auto-Responder for Priority Emails — triage to tasks
Detect important emails (from boss/alerts) and create a task in Todoist/Notion/JSON.
# pseudocode: use IMAP to fetch unseen messages, simple rule-based scoring
for mail in fetch_unseen():
score = 0
if "urgent" in mail.subject.lower(): score+=5
if mail.from_ in ["boss@example.com"]: score+=10
if score>7: create_task(mail.subject, mail.snippet)
Pro tip: always label but don’t auto-delete; leave final answer to human.
12) Auto-Generate Meeting Agendas from Action Items
Collect open action items from past notes and produce a focused agenda.
# store tasks as JSON; generate agenda with top N overdue tasks
import json
tasks = json.load(open("actions.json"))
agenda = sorted([t for t in tasks if not t["done"]], key=lambda x: x["due"])[:8]
print("\n".join([f"- {t['task']} (owner: {t['owner']})" for t in agenda]))
Pro tip: include 2-minute status items only — keeps meetings lean.
13) Local Web Dashboard for Home Devices — network + uptime monitor
Ping devices, check ports, and show a small HTTP page with statuses.
# requires: flask
from flask import Flask, jsonify
import socket, time
app=Flask(__name__)
hosts=["192.168.1.1","192.168.1.100"]
def ping(h):
try: s=socket.create_connection((h,80),1); s.close(); return True
except: return False
@app.get("/status")
def status(): return jsonify({h:ping(h) for h in hosts})
app.run(port=5001)
Pro tip: run locally and expose via VPN rather than public port-forward.
Quick Pause
If you’re ready to sharpen your skills and save hours of
frustration,_
_99
PYTHON DEBUGGING TIPS**** is your go-to guide. Packed
with practical techniques and real examples, it’s the fastest way to
turn debugging from a headache into a superpower.
99 Python Debugging Tips — A Practical Guide for DevelopersDebug Smarter, Not Harder. Bugs are inevitable, wasted hours chasing them don’t have to be…abdurrahman12.gumroad.com
14) Auto-Trim Video Clips (cut silence/gaps) — perfect for lectures
Detect low-volume sections and cut them out to produce tighter videos.
# requires: pydub
from pydub import AudioSegment, silence
audio=AudioSegment.from_file("lecture.mp4", "mp4")
non_silence = silence.split_on_silence(audio, min_silence_len=700, silence_thresh=-40)
combined = sum(non_silence)
combined.export("lecture_trimmed.mp4", format="mp4")
Pro tip: keep short silence between segments to avoid jarring jumps.
15) Clipboard History + Quick Paste — tiny productivity engine
Keep last N clipboard entries and paste with a hotkey.
# requires: pynput, pyperclip
import pyperclip, time
history=[]
while True:
cur = pyperclip.paste()
if not history or cur!=history[0]:
history.insert(0,cur); history=history[:20]; print("Copied:",cur[:40])
time.sleep(0.5)
Pro tip: secure the clipboard history; avoid storing passwords.
16) Auto-Label and Move Bank PDFs — invoice, salary, mortgage
Read PDF text, use rule engine to label, then move into categorized folders.
# requires: PyPDF2
import PyPDF2, os, re, shutil
for f in os.listdir("bank_pdfs"):
t = PyPDF2.PdfReader(os.path.join("bank_pdfs",f)).pages[0].extract_text()
if re.search(r'salary|payroll', t, re.I): dest="Salary"
elif re.search(r'mortgage', t, re.I): dest="Mortgage"
else: dest="Other"
os.makedirs(dest, exist_ok=True); shutil.move(os.path.join("bank_pdfs",f), os.path.join(dest,f))
Pro tip: always run a sample batch and review before full automation.
17) Auto-rotate SSH Keys / Audit Keys — security hygiene script
Scan ~/.ssh/authorized_keys, identify unused keys by
last-used logs (if available) and generate a rotation reminder.
import os, subprocess, time
auth="/home/user/.ssh/authorized_keys"
with open(auth) as f: keys=f.readlines()
# naive: print keys; integrate with bastion logs to find last use
for i,k in enumerate(keys,1): print(i, k[:40])
Pro tip: connect this to your team’s key management workflow; never remove keys without owner confirmation.
18) Auto-prune Docker Images & Containers — reclaim disk safely
List exited containers and dangling images, optionally remove older than X days.
import subprocess
def cmd(c): return subprocess.check_output(c, shell=True).decode()
print(cmd("docker container prune -f"))
print(cmd("docker image prune -af"))
Pro tip: run in dry-run mode first
(docker images --filter dangling=true) and keep a weekly
scheduled prune.
19) Auto-Generate README from Codebase — doc scaffolding
Parse functions and docstrings to create a minimal README.md.
import ast, os
out=[]
for py in [f for f in os.listdir('.') if f.endswith('.py')]:
tree=ast.parse(open(py).read())
for node in [n for n in tree.body if isinstance(n, ast.FunctionDef)]:
out.append(f"### {node.name}\n{ast.get_docstring(node) or 'No docstring.'}\n")
open("README.md","w").write("\n".join(out))
Pro tip: integrate with pre-commit to keep docs updated automatically.
20) Auto-translate Short Notes — multilingual quick wins
Watch a folder for .txt and auto-translate into target
language using a translation library.
# requires: googletrans
from googletrans import Translator
t=Translator()
for f in os.listdir("notes"):
if f.endswith(".txt"):
txt=open(os.path.join("notes",f)).read()
tr=t.translate(txt, dest='es')
open(os.path.join("notes", f"{f}.es.txt"), "w").write(tr.text)
Pro tip: check quotas and privacy — use a self-hosted model for sensitive notes.
21) Auto-generate Unit Tests Skeletons — jumpstart testing
Create test stubs for all functions missing tests (great for legacy code).
import ast, os
for py in [f for f in os.listdir('.') if f.endswith('.py')]:
tree=ast.parse(open(py).read())
names=[n.name for n in tree.body if isinstance(n, ast.FunctionDef)]
with open("tests/test_"+py, "w") as out:
out.write("import pytest\nimport "+py.replace(".py","")+"\n\n")
for name in names: out.write(f"def test_{name}():\n assert True # TODO: add tests for {name}\n\n")
Pro tip: follow up with property-based tests (hypothesis) for complex functions.
22) Auto-annotate DataFrames with Types and Ranges — faster EDA
Scan CSVs and produce a schema with ranges, missingness, and best-fit types.
import pandas as pd
df=pd.read_csv("dataset.csv")
schema = {col: {"dtype": str(df[col].dtype), "nulls": int(df[col].isna().sum()), "min": df[col].min() if df[col].dtype!='object' else None, "max": df[col].max() if df[col].dtype!='object' else None} for col in df.columns}
print(schema)
Pro tip: use this schema for quick data validation in ETL pipelines.
23) Auto-rename Screenshots with Context — app/window + timestamp
Detect active window title and rename new screenshots accordingly.
# Windows example uses pygetwindow, macOS requires accessibility APIs
import pygetwindow as gw, os, time
title = gw.getActiveWindow().title if gw.getActiveWindow() else "screenshot"
ts = time.strftime("%Y%m%d-%H%M%S")
os.rename("/path/to/Screen.png", f"/path/to/{title}_{ts}.png")
Pro tip: sanitize window titles to valid filenames.
24) Auto-rotate API keys in config files (safest path)
Search env/config files for keys flagged as expired and replace with new ones from vault.
# pseudocode: requires integration with your secrets manager
# fetch new_key = vault.get("service_api_key")
# replace in config files and reload service
Pro tip: never store plaintext keys in repo; rotate via CI/CD with immutable releases.
25) Personal Knowledge Base: auto-index notes with embeddings for search
Build a tiny local vector DB (Faiss) and embed new notes for fast semantic search.
# requires: sentence-transformers, faiss
from sentence_transformers import SentenceTransformer
import faiss, os
model = SentenceTransformer('all-MiniLM-L6-v2')
docs=[open(f).read() for f in os.listdir("notes") if f.endswith(".md")]
emb = model.encode(docs)
idx = faiss.IndexFlatL2(emb.shape[1]); idx.add(emb)
q = model.encode(["how to deploy?"])
D,I = idx.search(q, k=3)
print([docs[i][:200] for i in I[0]])
Pro tip: store (doc_id, filepath) mapping for retrieval; keep embeddings local for privacy.
Debug Smarter, Faster! 🐍 Grab your Python Debugging Guide — Click here to download!
99 Python Debugging Tips — A Practical Guide for DevelopersDebug Smarter, Not Harder. Bugs are inevitable, wasted hours chasing them don’t have to be…abdurrahman12.gumroad.com
If you enjoyed reading, be sure to give it** 50** CLAPS!Follow and don’t miss out on any of my future posts —** subscribe** to my profile for must-read blog updates!
Thanks for reading!
1
Follow
Written by Abdur Rahman
1M+ Views online ✨ Entrepreneur | AI Lover | Developer | Writer.
Follow
Responses (1)
Write a response
Cancel
Respond
Muhammad Fiaz Asimhe/she/her/them
Python Scripts great tpoic bcz now a days Python most importany lamguage.
Reply
More from Abdur Rahman
In
by
7 Python Automation Projects You Can Build in Less Than 2 Hours EachSmall Builds. Big Impact.
Aug 1
In
by
6 Python Libraries So Fast, I Stopped Using MultithreadingYes, they’re that optimized — and no weird bugs to debug
Aug 4
In
by
9 Python Libraries That Make Automation Stupidly SimpleGoodbye manual clicks, hello free time.
Sep 8
In
by
6 Python Scripts I Run Every Morning Before Writing a Single Line of CodeThink of them as my daily coffee for productivity.
Aug 21
Recommended from Medium
In
by
The Python Libraries That Made My Scripts Feel Like Full ProductsFrom quick hacks to production-ready systems, these tools transformed how I code
6d ago
In
by
4 Python Class Things We Use In Prod (& 3 We Don’t)Read free: https://www.linkedin.com/pulse/4-python-class-things-we-use-prod-3-dont-the-python-rabbithole-sextc
Sep 14
In
by
Claude’s NEW Features Will Blow Your MindClaude has been now evolved as a beast with the new updates.
Sep 12
In
by
10 Python Libraries That Make Text Processing SimpleClean, parse, and analyze without tears.
5d ago
In
by
How to Export Beautifully Formatted Tables from Python to Excel, CSV & HTML (Without Losing Style)Have you ever spent hours making a beautifully styled table in Python… colors, bold headers, aligned columns, all looking like it just…
Sep 13
In
by
12 Python Libraries So Addictive, I Couldn’t Stop Building ProjectsI thought they were overhyped… until I used them once.
Sep 5
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%

.gif)
.gif)
![]()
amazon.com
Sign up to Amazon Prime for unlimited free delivery
amazon.com
> *[ PMC ]: Penske Media Corporation
© 2026 rcanzlovar.com | About | Contact | Privacy Policy |
![]()






