A Python tool that automatically renames your music files using their metadata tags. Transform messy filenames like 156418671(2).mp3 into clean, organized names like Artist Name - Song Title.mp3.
- Automatic Metadata Reading: Extracts artist and title information from music file tags
- Smart Filename Cleaning: Removes invalid characters and formats filenames properly
- Safe Operation: Dry-run mode to preview changes before applying them
- Multiple Format Support: Works with MP3, FLAC, WAV, M4A, OGG, AAC, and more
- Cross-Platform: Works on Windows, macOS, and Linux
- User-Friendly: Both command-line and interactive modes available
music_folder/
├── 156418671(2).mp3
├── track1(128).mp3
├── unknown_song.flac
└── recording2023.m4a
music_folder/
├── Taylor Swift - Love Story.mp3
├── The Beatles - Hey Jude.flac
├── Queen - Bohemian Rhapsody.m4a
└── Unknown Artist - recording2023.mp3
-
Clone the repository:
git clone https://github.com/yourusername/music-name-fixer.git cd music-name-fixer -
Install dependencies:
pip install music-tag
python music_name_fixer.pyThen enter your music directory path when prompted.
Process a specific directory (dry run - preview only):
python music_name_fixer.py "/path/to/your/music"Actually rename files:
python music_name_fixer.py --apply "/path/to/your/music"Verbose output with detailed information:
python music_name_fixer.py --verbose "/path/to/your/music"Show help:
python music_name_fixer.py --helpProcess multiple directories:
# Process your downloads folder
python music_name_fixer.py --apply "~/Downloads/Music"
# Process current directory
python music_name_fixer.py --apply "."
# Process with detailed logging
python music_name_fixer.py --verbose --apply "/path/to/music"- Reads Metadata: Extracts ID3 tags and other metadata from music files
- Sanitizes Filenames: Removes invalid characters (
/,?,*, etc.) - Formats Consistently: Uses
Artist - Title.extformat - Handles Errors: Skips files with missing metadata and provides clear error messages
- Prevents Duplicates: Checks for existing files before renaming
- MP3 (.mp3)
- FLAC (.flac)
- WAV (.wav)
- M4A (.m4a)
- OGG (.ogg)
- AAC (.aac)
- Opus (.opus)
"No metadata found" errors:
- Some files may not have proper ID3 tags
- The script will use the original filename as a fallback
"File already exists" errors:
- Multiple files might have the same artist and title
- The script will skip these to prevent data loss
Permission errors:
- Make sure you have read/write permissions for the music directory
- On Windows, try running as Administrator
- On Linux/macOS, check file permissions with
ls -la
If you encounter any bugs or have questions:
- Check the verbose output with
--verboseflag - Ensure your music files have proper metadata tags
- Try the dry-run mode first to preview changes
- Built with music-tag for metadata reading
- Thanks to all contributors and bug reporters
Note: Always backup your music files before running the tool with --apply flag. The developers are not responsible for any data loss.
⭐ If this project helped you, please give it a star! ⭐