Assorted tools for working with Calibre, the eBook management software. At the moment, this consists only of;
A script to create a directory of cover art files, one for each book in the library, for use in screensavers and such.
This directory includes Bash utilities to manage and clean up tags in a Calibre ebook library using the calibredb CLI.
List a deduplicated, sorted set of all tags in your Calibre library.
Usage:
./list_calibre_tags.sh "/path/to/Calibre Library"Remove a specified tag from all books. Supports tags with spaces and includes dry-run mode.
Usage:
./remove_calibre_tag.sh "/path/to/Calibre Library" "tag to remove" --dry-run
./remove_calibre_tag.sh "/path/to/Calibre Library" "tag to remove"Removes all tags from all books except those listed in a .txt file (one tag per line). Includes dry-run mode, live progress, and logs actions to a file.
Usage:
./keep_only_these_tags.sh "/path/to/Calibre Library" keep_tags.txt --dry-run
./keep_only_these_tags.sh "/path/to/Calibre Library" keep_tags.txtExample keep_tags.txt:
sci-fi
history
programming
Each destructive operation logs original tags per book ID. To undo changes:
- Locate the log file (e.g.,
tag_cleanup_log_live_20250420_142355.txt) - Use a recovery script (to be created) that reads the log and restores the original tags.
Example log entry:
Updated ID 123 'Example Book': Tags => [history, sci-fi]
To support undo, logs could optionally include:
ID:123 | TITLE:Example Book | OLD:[sci-fi, fiction] | NEW:[history]
This will allow future tooling or scripts to parse and restore original metadata.
calibredb(installed with Calibre)jq(for parsing JSON output)
Install jq if needed:
sudo apt install jq- All scripts support paths with spaces (wrap in quotes)
- Logs are timestamped and saved in the current working directory
- Scripts do not require Python
Let us know if you'd like to add undo support, backups, or CSV output.
This project is licensed under the MIT License. See the LICENSE file for details.