A basic bash script to convert folders of images into a single cbz archive.
Only zip and unzip packages (and coreutils).
./cbzator.sh [-h] [--merge <input_cbz> <folder_to_add>] [<input_directory> <output_directory>]
To generate a cbz archive from images in input directory: ./cbzator.sh in_dir out_dir.
in_dirmust be a folder containing.jpgfiles OR a folder of folders containing.jpgfiles. It won't work as expected if the folder contains a mixture of folders and images. To use with.pngjust edit the script. Note thatsort -Vis used to determine image/folder ordering.out_diris the path where the script will place the resulting archive, named after the input folder. If this file already exists, it will ask for confirmation before deleting it. The script will also create a temporary directorytempwhich will be removed when finished. If the folder already exists, the script will overwrite its content.
You can also add images to a previously generated archive by specifying option -m or --merge. Images will be
appended to the previous one. The new images are sorted with sort -V and the output file with name my_archive.cbz
will be placed in the same folder as the file given in input. If the file already exists, it is replaced.
Example: ./cbzator.sh -m path_to_file.cbz new_images_dir.
Folder new_images_dir must have the same format as in_dir described above.