A fast and reliable CBR to CBZ conversion tool for GNU/Linux, written in pure bash, with support for single-file and directory processing (including recursive and parallel workflows). It preserves timestamps, handles tricky filenames, skips already converted files, supports optional cleanup, and can inject ComicInfo.xml metadata during single-file conversion.
-
A GNU/Linux distribution (tested on Ubuntu)
-
unrar-nonfreefor RAR5+ support andzipfor creating CBZ files -
nprocorgetconffor CPU detection (usually pre-installed)sudo apt-get install unrar-nonfree zip
-
Clone this repository or download the
cbr2cbz.shscript -
Make it executable:
chmod +x cbr2cbz.sh
-
(Optional) Move it to your PATH, for example:
sudo mv cbr2cbz.sh /usr/local/bin/cbr2cbz
./cbr2cbz.sh file.cbr./cbr2cbz.sh --comicinfo /path/to/ComicInfo.xml file.cbr./cbr2cbz.sh /path/to/comics./cbr2cbz.sh -r /path/to/comicsUse the -j or --jobs option to specify the number of parallel jobs (defaults to number of CPU cores):
# Use 4 parallel jobs
./cbr2cbz.sh -j 4 /path/to/comics
# Combine with recursive and cleanup
./cbr2cbz.sh -r -c -j 8 /path/to/comics./cbr2cbz.sh --helpUse -i or --comicinfo to add a metadata XML file into the output archive as ComicInfo.xml.
This option is supported only when processing a single input file.
If the archive already contains ComicInfo.xml, the script asks whether to overwrite it.
./cbr2cbz.sh -i ./ComicInfo.xml ./issue_001.cbrTo skip the overwrite prompt and always replace an existing ComicInfo.xml, add:
./cbr2cbz.sh -i ./ComicInfo.xml --comicinfo-overwrite ./issue_001.cbrTo automatically remove the original CBR files after successful conversion, use the -c or --cleanup flag:
# Convert and remove original CBR files
./cbr2cbz.sh -c file.cbr
# Process a directory and clean up
./cbr2cbz.sh -c /path/to/comics
# Combine with recursive processing
./cbr2cbz.sh -r -c /path/to/comics
⚠️ Note: The cleanup option permanently deletes the original CBR files after successful conversion. Use with caution!
- Scans for CBR files in the specified location (recursively if
-ris used) - Processes files in parallel (up to the number of CPU cores by default, or as specified by
-j) - For each file:
- Creates a temporary directory
- Extracts the CBR (RAR) file contents using
unrar - Optionally injects
ComicInfo.xmlwhen--comicinfois used in single-file mode - Creates a new CBZ (ZIP) file with the same name
- Preserves the original file's modification timestamp
- If
--cleanupis specified, removes the original CBR file - Cleans up temporary files
- Shows progress and summary of processed files
- Open Format: CBZ uses the standard ZIP format, which is open and widely supported
- Better Compatibility: Many comic book readers have better support for CBZ
- Free Software: Avoids dependency on proprietary RAR format
This project is licensed under the MIT License
This repository is based on the original work from oogg06/cbr2cbz.
Contributions are welcome! Please feel free to submit a Pull Request.