Results 1 to 6 of 6

Thread: Convert .cbr to .cbz

  1. #1
    Join Date
    Feb 2008
    Location
    Dublin, Ireland
    Beans
    52
    Distro
    Kubuntu 12.04 Precise Pangolin

    Question Convert .cbr to .cbz

    Hey, I have a Comic book reader called TouchComic for my phone, and I want to read comics on it. (Naturally enough)
    Unfortunately it only reads .cbz (comic book zip) or .zip files and most of my comic books are in .cbr (comic book rar) format.

    Manually converting them is a fairly simple process, but it's annoyingly slow and labour intensive.
    How can I create a script that will automatically convert them for me? (7zip happily opens both, and creates zips/cbz)

    thanks,
    -ANkh

  2. #2

    Re: Convert .cbr to .cbz

    I'm using this bash script to do the conversion:
    http://www.kingbin.net/blog/2009/11/03/285/

    Other than replacing spaces with underscores, it seems to work pretty great.

  3. #3
    Join Date
    Feb 2008
    Location
    Dublin, Ireland
    Beans
    52
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Convert .cbr to .cbz

    Quote Originally Posted by Jonathan Harford View Post
    I'm using this bash script to do the conversion:
    http://www.kingbin.net/blog/2009/11/03/285/

    Other than replacing spaces with underscores, it seems to work pretty great.
    That sounds great, thanks!

  4. #4

    Re: Convert .cbr to .cbz

    Now I see that some of the CBZs I've converted contain the original CBRs inside them, making them over twice as big as the CBRs! Grrr.

  5. #5
    Join Date
    Aug 2009
    Beans
    2

    Re: Convert .cbr to .cbz

    I made a slightly improved version of the script. This one requires the proprietary "unrar" binary, like the older one, but it should not put cbr files inside cbz. Also, it takes one file at a time; you can use a simple for loop yourself!
    Code:
    for a in *.cbr;do cbr2cbz "$a";done
    Code:
    #bin/bash
    
    cbr=$1
    start_directory=`pwd`
    
    cbz=`basename "$cbr" .cbr`.cbz
    
    tempdir=`mktemp -d`
    cd "$tempdir"
    unrar e -inul "$start_directory/$cbr"
    zip -q "$start_directory/$cbz" *
    rm -rf "$tempdir"
    Also, it doesn't change file names (except replacing .cbr with .cbz of course), and uses a generated temporary folder in /tmp/ instead of a fixed name. And it doesn't copy around the files like the previous one; unrar will extract to the current directory, there's no need for any copying.

  6. #6
    Join Date
    Jan 2008
    Beans
    7

    Re: Convert .cbr to .cbz

    Hi Albins!

    Thanks a lot for your script. It works like a charm!


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •