Created
August 5, 2023 18:26
-
-
Save lmas/a9abc3d5248426807c4427e6026a89a3 to your computer and use it in GitHub Desktop.
Convert CBR files to CBZ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e pipefail | |
# Converts all CBR files in current dir to CBZ | |
# Source: | |
# https://ubuntuforums.org/showthread.php?t=1273762&s=a388d691ed1d259329dc26304528a056&p=8676006#post8676006 | |
convert() { | |
dir=$(pwd) | |
cbr="$1" | |
name=$(basename "$cbr" .cbr) | |
tmpdir=$(mktemp -d) | |
cd "$tmpdir" | |
unrar e -inul "$dir/$cbr" | |
zip -q "$dir/$name.cbz" ./* | |
cd "$dir" | |
rm -rf "$tmpdir" | |
} | |
for f in *.cbr; do | |
echo "converting $f" | |
convert "$f" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment