Convert RAR, CAB, ISO, etc To ZIP

Recently I ran into a situation where I needed to convert some relatively obscure archive files (e.g. RAR) to the ZIP format. That’s easy enough if you only need to deal with a single file – just extract it using your favorite archiver and re-compress the extracted files as .zip.

However, manually converting dozens of files would take forever, not to mention how excrutiatingly tiresome it would be. So I wrote a Windows batch file that can convert any number of archives to ZIP using the open-source archiver 7-Zip. I’m posting the converter here in case anyone finds it useful.

Features

Converts (almost) any archive format to ZIP.

Supports wildcards.

You can set the output directory for the converted files. By default they’re created in the current directory.

Usage

The batch file takes up to two command line arguments. The first argument must be the name of the file to be converted. For example, this could be “oldarchive.arj” or “c:\backup\oldarchive.arj” if the file is not in the current directory. You can also use wildcards to convert multiple files in one go.

The second argument specifies the directory where to put the converted files. Setting it is optional – the converter will use the current directory by default. If you do set the output directory, don’t forget to include the final backslash in the directory name or the converter will make a mess.

Examples

Convert “somefile.rar” that is located in the current directory to “somefile.zip” :zipconv somefile.rar

Convert all CAB files from the current directory to ZIP :zipconv *.cab

Convert all RAR files to ZIP and put the converted files in a subdirectory “converted_files” (this directory wil be created if it doesn’t exist) :zipconv *.rar ".\converted_files\"

This entry was posted on Thursday, January 29th, 2009 at 00:29 and is filed under Miscellany.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.

I dont know why people are complaining about the RAR format its great the only thing i want to do is find a quick way to convert it to ZIP for my friends who download files and dont have an RAR extractor i told them to download one but they wont so i convert them to ZIP and transfer it to them!!!!!

:startprocessing
rem Is the input pattern set?
if “%1″==”” goto :nopattern
rem Is the output folder set? (optional – by default, the current directory is used)
if not “%2″==”” (set outdir=”%~dp2″) else (set outdir=”.\”)

Wow, that was MUCH FASTER than the system PeaZip uses…and being command-line I don’t get asked any questions. Putting the bat file in my path, I can really breeze through the conversions I need to do now. Very well thought out script to handle all versions of 7-Zip, too.

Search

This site uses cookies to improve your experience, to personalize ads and to analyze traffic. It also shares information about your use of this site with social media, advertising and analytics partners. By using this site, you agree to its use of cookies. AcceptSee Details