Member-only story
20 Python Scripts To Automate Your Daily Tasks
5 min readNov 14, 2024
Python is a powerful tool for automating repetitive tasks, it helps you save time, reduce errors, and focus on more important work, being a lazy developer pays off sometimes. lets get to it!
1. Bulk File Renamer
Rename multiple files in a folder by specifying the prefix, suffix, or pattern.
import os
for i, filename in enumerate(os.listdir("path/to/folder")):
os.rename(filename, f"renamed_file_{i}.txt")
2. Email Sender
Send an email automatically using Python’s smtplib
.
import smtplib
from email.message import EmailMessage
msg = EmailMessage()
msg.set_content("Hello! This is an automated email.")
msg["Subject"] = "Automated Email"
msg["From"] = "you@example.com"
msg["To"] = "recipient@example.com"
with smtplib.SMTP_SSL("smtp.example.com", 465) as smtp:
smtp.login("you@example.com", "your_password")
smtp.send_message(msg)
3. File Organizer
Organize files in a directory by their extensions.