How can I bulk rename files in a RAR or ZIP archive on the mac?

Posted by Chris R on Super User See other posts from Super User or by Chris R
Published on 2010-01-28T22:11:45Z Indexed on 2010/03/09 11:38 UTC
Read the original article Hit count: 299

Filed under:
|
|
|
|

I have a set of archive files -- both zip and rar formats -- inside of which I need to rename some files. Specifically, I want to do something like this:

for each archive file in a directory
    for each file in the archive
        if the file name matches the regular expression /(.* - [0-9]{2})([0-9]{2} - .)*/
            rename the file as \1-\2

The trick isn't so much in the generation of the new name; I can do that with either bash or sed or anything else. It's the set of commands to manipulate the files in the archives using rar/unrar or unzip/zip

(If it makes a difference, I'm re-formatting some CBR/CBZ files to get the double-page spreads to come up in the right order in SimpleComic -- it interprets page 0203 as page 203, which makes the story a bit hard to follow)

© Super User or respective owner

Related posts about rename

Related posts about osx