← Back to all products
$29
Python Automation Scripts
50+ automation scripts for file processing, email, PDF generation, spreadsheets, APIs, and system administration.
JSONMarkdownYAMLPythonDocker
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 19 files
python-automation-scripts/
├── LICENSE
├── README.md
├── configs/
│ └── scripts_config.yaml
├── guides/
│ └── automation-guide.md
├── scripts/
│ ├── api_tester.py
│ ├── csv_processor.py
│ ├── db_backup.py
│ ├── docker_cleanup.py
│ ├── env_checker.py
│ ├── file_organizer.py
│ ├── git_stats.py
│ ├── log_analyzer.py
│ ├── report_generator.py
│ └── ssl_checker.py
├── tests/
│ ├── test_csv_processor.py
│ └── test_file_organizer.py
└── utils/
├── notifier.py
└── runner.py
📖 Documentation Preview README excerpt
Python Automation Scripts
10 production-ready automation scripts for file management, data processing, API testing, log analysis, backups, and more.
What You Get
- 10 standalone scripts — each solves a real DevOps / data task
- Shared utilities for running scripts and sending notifications
- YAML config for centralised settings
- Tests for the most complex scripts
- Guide with customisation tips and scheduling advice
File Tree
python-automation-scripts/
├── README.md
├── manifest.json
├── LICENSE
├── scripts/
│ ├── file_organizer.py # Sort files into folders by type/date
│ ├── csv_processor.py # Clean, filter, and transform CSVs
│ ├── api_tester.py # Smoke-test REST APIs
│ ├── log_analyzer.py # Parse logs, extract errors, summarise
│ ├── db_backup.py # Backup SQLite/Postgres to compressed archive
│ ├── env_checker.py # Verify Python env & dependencies
│ ├── report_generator.py # Generate HTML/PDF reports from data
│ ├── git_stats.py # Analyse git repo commit history
│ ├── docker_cleanup.py # Prune unused Docker resources
│ └── ssl_checker.py # Check SSL certificate expiry dates
├── utils/
│ ├── runner.py # Script runner with logging & timing
│ └── notifier.py # Send alerts via email / Slack / webhook
├── configs/
│ └── scripts_config.yaml # Centralised configuration
├── tests/
│ ├── test_csv_processor.py # Tests for CSV processing
│ └── test_file_organizer.py # Tests for file organiser
└── guides/
└── automation-guide.md # Customisation & scheduling guide
Getting Started
1. Install Dependencies
pip install pyyaml requests jinja2
2. Run a Script
python scripts/file_organizer.py --source ~/Downloads --dest ~/Sorted
3. Use the Runner
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
scripts/file_organizer.py"""File Organizer — sort files into subdirectories by extension or date.
Usage:
python file_organizer.py --source ~/Downloads --dest ~/Sorted
python file_organizer.py --source ~/Downloads --dest ~/Sorted --by date
"""
from __future__ import annotations
import argparse
import shutil
from collections import defaultdict
from datetime import datetime
from pathlib import Path
# Extension → category mapping
CATEGORIES: dict[str, str] = {
".jpg": "images", ".jpeg": "images", ".png": "images", ".gif": "images",
".svg": "images", ".webp": "images", ".bmp": "images",
".mp4": "videos", ".mkv": "videos", ".avi": "videos", ".mov": "videos",
".mp3": "audio", ".wav": "audio", ".flac": "audio", ".ogg": "audio",
".pdf": "documents", ".doc": "documents", ".docx": "documents",
".xls": "documents", ".xlsx": "documents", ".pptx": "documents",
".txt": "text", ".md": "text", ".csv": "text", ".json": "text",
".py": "code", ".js": "code", ".ts": "code", ".java": "code",
".zip": "archives", ".tar": "archives", ".gz": "archives", ".rar": "archives",
}
def categorize_by_extension(file: Path) -> str:
"""Return the category for a file based on its extension."""
return CATEGORIES.get(file.suffix.lower(), "other")
def categorize_by_date(file: Path) -> str:
"""Return a YYYY-MM folder name based on the file's modification time."""
mtime = file.stat().st_mtime
dt = datetime.fromtimestamp(mtime)
return dt.strftime("%Y-%m")