An intelligent file renaming tool that automatically extracts names from metadata (EXIF, ID3, MP4 tags) and organizes your media collection. Perfect for photographers, musicians, and digital hoarders!
- π Metadata Extraction - Reads EXIF (images), ID3 (audio), and MP4 tags (video)
- π·οΈ Intelligent Renaming - Uses metadata when available, fallback to clean names
- π Multi-folder Support - Process multiple directories in one run
- π‘οΈ Safe Operations - Dry-run mode, collision detection, and detailed logging
- π Comprehensive Reports - JSON results with full operation details
- π Cross-Platform - Works on Windows, macOS, and Linux
- β‘ Fast & Efficient - Processes thousands of files quickly
| Category | Formats | Metadata Sources |
|---|---|---|
| Images | JPG, PNG, HEIC, TIFF, WebP, GIF | EXIF, XMP, IPTC |
| Audio | MP3, M4A, FLAC, WAV, OGG, WMA | ID3, MP4 tags, Vorbis comments |
| Video | MP4, MOV, AVI, MKV, WMV | MP4 metadata, ASF tags |
-
Clone the repository:
git clone https://github.com/yourusername/smart-file-labeler.git cd smart-file-labeler
-
Install dependencies:
pip install -r requirements.txt
Basic Usage
Rename files in default folders (music, videos, images):
python file_labeler.py --base-folder /path/to/your/media
Dry-run (simulation only):
python file_labeler.py --dry-run --verbose
Custom folders and prefix:
python file_labeler.py --folders photos music --prefix "Uncategorized"
π Example Transformation Before:
vacation_2023/ βββ DSC_001.jpg (EXIF: "Beach Sunset") βββ song123.mp3 (ID3: "Blinding Lights") βββ video001.mp4 (MP4: "Birthday Party")
After:
vacation_2023/ βββ Beach_Sunset.jpg βββ Blinding_Lights.mp3 βββ Birthday_Party.mp4
π οΈ Advanced Usage Custom Configuration Create a configuration file for repeated use:
alias organize-media="python file_labeler.py --base-folder ~/Media --folders photos music videos --prefix 'Unsorted'"
Integration with Other Tools Use as a Python module:
from file_labeler import FileLabeler, MetadataExtractor
extractor = MetadataExtractor() metadata = extractor.extract_metadata_name(Path("your_file.jpg"))
labeler = FileLabeler("/media", ["photos", "music"]) results = labeler.process_all_folders(dry_run=True)
Shell Script Integration Create a cleanup script:
BASE_DIR="$1" python file_labeler.py --base-folder "$BASE_DIR" --folders images audio video --force
π Project Structure
smart-file-labeler/ βββ file_labeler.py # Main script βββ requirements.txt # Dependencies βββ README.md # This file βββ examples/ # Usage examples β βββ before/ # Sample files before β βββ after/ # Sample files after βββ tests/ # Test suite β βββ test_metadata.py # Metadata tests β βββ test_renamer.py # Renaming tests βββ results/ # Generated reports
βοΈ Configuration Options Option Description Default
--base-folder Root directory for media Current directory --folders Subdirectories to process music videos images --prefix Name for files without metadata Unlabeled --dry-run Simulate without changes False --verbose Detailed logging False --force Skip confirmation False --output-format Results format json
π€ Contributing We welcome contributions! Here's how to help:
Report Issues - Found a bug? Open an issue with details Request Features - Have an idea? Share it! Submit Code - Fix bugs or add features via pull requests
Development Setup
git clone https://github.com/yourusername/smart-file-labeler.git cd smart-file-labeler
pip install -e ".[dev]"
pytest tests/
black file_labeler.py
Adding Support for New Formats
Add extension to appropriate set in MetadataExtractor Implement extraction method for the format Add tests in tests/test_metadata.py
π Acknowledgments Pillow for image processing mutagen for audio/video metadata All contributors and users who help improve this tool
Made with β€οΈ for organized digital lives β If this tool helps you, please consider starring the repository!