Converting file types in shell

I’ve been really wanting to convert the file type of my .cbr and create some php pages with them to view from anywhere. The first step I’m covering is how to convert the files into a compression format that I can work with.  First of all, .CBR and .CBZ files are .RAR and .ZIP, respectively.

So, starting with CBR:

for file in *.cbr ; do cp $file `echo $file | sed ‘s/\(.*\.\)cbr/\1rar/’` ; done

CBZ:

for file in *.cbz ; do cp $file `echo $file | sed ‘s/\(.*\.\)cbz/\1zip/’` ; done

Next time, I’ll write this in python.  Just for fun.

Comments