A Python tool that automatically renames EPUB files based on their metadata. The script extracts information such as author, title, publication year, and publisher from the EPUB metadata and renames the files to a standardized format:
AUTHOR - TITLE (YEAR, PUBLISHER).epub
If no publisher information is available, the format is reduced to AUTHOR - TITLE (YEAR).epub
.
- Python 3.6+
- ebooklib
- python-dateutil
python rename_ebook.py my_ebook.epub
python rename_ebook.py ebook1.epub ebook2.epub ebook3.epub
python rename_ebook.py "ebooks/*.epub"
python rename_ebook.py --dry-run my_ebooks/*.epub
or shorter:
python rename_ebook.py -d my_ebooks/*.epub
- The script creates a backup of the original file with the ".old" extension
- No changes are made if the target file already exists