
# Lets ensure the permissions allow us to pack everything # We use RAR file's name to create folder for unpacked files # And the directory path for that file, so we know where to put the finished ".cbz" First, extract the base file name (without the extension) Note the backtics ("`") (the key above the tab key on USįor CBRFILE in `find "$SOURCEDIR" -name "*.cbr" -printf "%p|while read line do # "-printf "$p|" will cause the file names to be separated by the pipe symbol, rather than # Now, execute a loop, based on a "find" command in the specified directory. # We need an empty directory to work in, so we'll create a temp directory here # Note: "$1" = "The first command line argument" # directory into a shell variable called SOURCEDIR. # then default to the current working directory ("."). Just to be paranoid, if no directory is specified, # The script should be invoked as "cbr2cbz " is the This directory will be created under WORDDIR # For performance reasons I'm using ram disk (/dev/shm/) in Ubuntu server. The user you are using must have permission # Set working directory where to create the temp dir. I'm using the pipe symbol ("|") as it is very # in the file names don't mess things up. # Set the "field separator" to something other than spaces/newlines" so that spaces Question/tl dr: What would be the "best"/adequate approach to add a integrity file check to the script below? #!/bin/bash I guess it's a matter of using if & else here(?) to check the integrity and then give it another go, if there are any error. p7zip can test the archive by: 7z t comicfile.cbz tmpworkingdir

I modified said script slightly to use p7zip as it can both pack/unpack 7z, zip-files and some others, i. Issue: Sometimes the repackaging of the files doesn't end well and would hopefully be alleviated by a integrity check & another go.

cbz is besides escaping the proprietary rar file format, that one can store the metadata from Comic Vine with e. Surprisingly enough there no cbr -> cbz converters out there. These files are basically your average rar and zip files, however renamed to another extension as they are used for (comic)book applications such as comicrack, qcomicbook and what not.

Thanks in advance for taking your time to reading this/answering my question!ĭescription: I found a script that converts/repack. Apparently my searchfoo is really weak in this area, I guess it's a question of terminology. I understand very basic stuff, but when it comes to checking exit codes or what the adequate term is, I'm at a loss. First post, so Hi! Let me start by saying I'm a total noob regarding programming.
