10 useful Python automation scripts for everyday file, data, and system tasks.
| # | Script | Description |
|---|---|---|
| 1 | image-resizer.py | Bulk resize images using PIL |
| 2 | csv-to-json.py | Convert CSV files to JSON |
| 3 | folder-sync.py | Sync two folders, mirror deletions |
| 4 | text-search.py | Recursive text search across files with context lines |
| 5 | url-checker.py | Check if URLs are alive (HTTP status checker) |
| 6 | file-splitter.py | Split large files into chunks |
| 7 | date-organizer.py | Organize files into YYYY/MM/DD folders by date modified |
| 8 | color-extract.py | Extract dominant colors from images |
| 9 | json-to-csv.py | Flatten nested JSON to CSV |
| 10 | system-cleaner.py | Find and clean temp files, cache, empty dirs |
Most scripts use only the Python standard library. A few require extra packages:
pip install pillow requests numpyimage-resizer.py→ Pillowcolor-extract.py→ Pillow, numpyurl-checker.py→ requests
# Resize all images in a directory to 800x600 (maintaining aspect ratio)
python image-resizer.py ./photos --width 800 --height 600
# Resize to 50% of original size
python image-resizer.py ./photos --percent 50
# Specify output directory
python image-resizer.py ./photos --width 1920 --output ./wallpapers# Basic conversion
python csv-to-json.py data.csv
# Pretty-print output
python csv-to-json.py data.csv --pretty
# Custom delimiter (e.g. tab-separated)
python csv-to-json.py data.tsv --delimiter $'\t'
# Specify output file
python csv-to-json.py data.csv --output data.json --pretty# Sync source to replica (creates replica, copies new/modified, deletes extra files)
python folder-sync.py ./original ./backup
# Dry run to preview changes
python folder-sync.py ./original ./backup --dry-run
# Exclude certain patterns
python folder-sync.py ./project ./backup --exclude .git --exclude node_modules
# Ignore hidden files
python folder-sync.py ./src ./dst --ignore-hidden# Basic search with 2 lines of context
python text-search.py "TODO" ./src
# Case-insensitive search in Python files only, 5 lines of context
python text-search.py "def main" ./ --ext py --context 5 --ignore-case
# Search with exclusions
python text-search.py "import os" . --ext py --exclude venv --exclude .git
# Limit file size
python text-search.py "error" /var/log --context 3 --max-size 5# Check individual URLs
python url-checker.py https://google.com https://github.com
# Check from file
python url-checker.py --file urls.txt
# Concurrent checking with custom timeout
python url-checker.py --file urls.txt --concurrent 20 --timeout 5# Split text file every 10000 lines
python file-splitter.py huge-log.txt --lines 10000
# Split binary file into 50MB chunks
python file-splitter.py video.mp4 --size 50MB
# Custom prefix and keep CSV header in each chunk
python file-splitter.py data.csv --lines 5000 --prefix data_chunk# Preview organizing Downloads folder
python date-organizer.py ~/Downloads --dry-run
# Move files into YYYY/MM/DD folders by modification date
python date-organizer.py ./photos --move
# Use creation date instead
python date-organizer.py ./photos --move --date-created
# Exclude certain patterns
python date-organizer.py ~/Downloads --move --exclude .tmp# Extract 5 dominant colors from an image
python color-extract.py photo.jpg
# Extract 10 colors in hex format only
python color-extract.py photo.jpg --colors 10 --format hex
# Process all PNGs in a directory
python color-extract.py ./images --glob *.png --colors 3# Convert JSON array to CSV
python json-to-csv.py data.json
# Custom delimiter
python json-to-csv.py data.json --delimiter ';'
# Specify output path
python json-to-csv.py data.json --output table.csv# Scan for temp files (dry run)
python system-cleaner.py ~/Downloads
# Actually delete temp files older than 30 days
python system-cleaner.py ~/Downloads --clean --max-age 30
# Target specific extensions and remove empty dirs
python system-cleaner.py . --clean --ext .pyc --remove-empty
# Only delete files larger than 1MB
python system-cleaner.py /tmp --clean --ext .tmp --min-size 1MBEvery script has a detailed help screen:
python <script-name>.py --helpMIT — Free for personal and commercial use.
If you find these scripts useful, consider buying me a coffee! ☕