Last active
August 30, 2022 03:25
-
-
Save darylf/2828928b51ce9d1bcbc839b6f2394977 to your computer and use it in GitHub Desktop.
Basch Script to Convert CBR to CBZ file
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 | |
FILENAME="$1" | |
DIR="$(dirname "$FILENAME")" | |
BASENAME=$(basename "$FILENAME" .cbr) | |
DIR_TMP="$DIR/tmp" | |
echo "Converting $FILENAME" | |
mkdir "$DIR_TMP" | |
echo " Extracting $FILENAME" | |
unrar x -idq "$FILENAME" "$DIR_TMP" | |
chmod -R 777 "$DIR_TMP" | |
echo " Compressing $DIR/$BASENAME.cbz" | |
(cd "$DIR_TMP"; zip -rq "../$BASENAME.cbz" .) && chmod --reference="$DIR/$BASENAME.cbr" "$DIR/$BASENAME.cbz" && rm "$FILENAME" | |
rm -rf "$DIR_TMP" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment