I'm looking for a good, preferably free, batch unzipping utility.
July 29, 2005 2:59 PM   Subscribe

I'm looking for a batch unzipping utility, with two stipulations.

1. The utility must have the ability to extract the contents of each zip archive into an individual folder that retains the name of the archive.
2. The utility would preferably be free.

So "apples.zip," "oranges.zip," "kumquats.zip," and "bananaphones.zip" should become folders "apples," "oranges," "kumquats," and "bananaphones" with the contents of each archive in the respective folder. The utility must ignore any directory structure already within the archives and just create a new structure based on the names of the archives alone.

Google came up with a lot of results but none of them looked like they would do the "extract to individual folders" thing. Heck, I have WinZip, and it will batch unzip files, but unless I'm using it wrong it wants to extract all the files to the same directory, which is not what I want.

Any solutions would be appreciated, thanks.
posted by Ziggy Zaga to Computers & Internet (12 answers total) 1 user marked this as a favorite
 
Best answer: I would go about using the command-line pkunzip.exe and just whip up a BATch file that, for each zipped file, creates a directory of the same name and then calls pkunzip.exe to extract to that directory (directory structure within the archive will be ignored unless you use pkunzip -d)
posted by rxrfrx at 3:12 PM on July 29, 2005


Best answer: This can be done easily using any decent shell. The following would work at a bash prompt and needs only the unzip command. Well, basename too. (Under linux, you already have this; under Windows install Cygwin or MSYS or GnuWin32 or ...)

for F in *.zip; do unzip $F -d `basename $F .zip` -j; done
posted by Rhomboid at 3:41 PM on July 29, 2005


I don't think you have completely specified what you want. Once you have, though, it should be easy to do with Cygwin, shell scripting, and the unzip command.

The utility must ignore any directory structure already within the archives and just create a new structure based on the names of the archives alone.

So I give you a apple.zip file that contains:

pink/lady.txt
red/delicious.txt
golden/delicious.txt

You want it to spit out a apple\ directory but with what inside? If you just ignore the directory structure then what do you do with the two files named delicious.txt?
posted by grouse at 3:44 PM on July 29, 2005


You want StuffIt Expander, it can be configured to make an enclosing folder with the same name as the archive. (Part of the StuffIt Standard trial download, but you can use the Expander part for free indefinitely without being nagged.)
posted by kindall at 4:11 PM on July 29, 2005


Oh, sorry, didn't see the bit about flattening the directories. Expander won't do that. In fact I can't think of any program that has that.
posted by kindall at 4:13 PM on July 29, 2005


Stuffit Deluxe has a very powerful scripting (and schedulling) tool. I'm not at one of my PCs at the moment, but soon as I am I'll see if it does what you want...
posted by krisjohn at 4:38 PM on July 29, 2005


Response by poster: I would go about using the command-line pkunzip.exe and just whip up a BATch file that, for each zipped file, creates a directory of the same name and then calls pkunzip.exe to extract to that directory (directory structure within the archive will be ignored unless you use pkunzip -d) - rxrfrx

Given what I'm working with, that sounds like it would work the easiest for me. I'll try it in a few minutes.

This can be done easily using any decent shell. The following would work at a bash prompt and needs only the unzip command. Well, basename too. (Under linux, you already have this; under Windows install Cygwin or MSYS or GnuWin32 or ...) - rhomboid

I'll have to try that if I can't make the batch file idea work.

You want it to spit out a apple\ directory but with what inside? If you just ignore the directory structure then what do you do with the two files named delicious.txt? - grouse

I would think that in such a case, either the program/utility i'm using would prompt me asking what to do with it, or would just skip it altogether and alert me of the incident at the end.
For my purposes though it isn't a concern because i'm dealing with zip archives full of files that have time/dates as filenames, so there's very little chance of having two identically-named files.

You want StuffIt Expander... - kindall
Stuffit Deluxe has a very powerful scripting (and schedulling) tool... - krisjohn

Thanks for the recommendations; I will try StuffIt if the first two ideas don't work. Flattening the directory structure isn't the most important thing I'm looking for in the type of utility I need, but it would just save me some work later on.

Thanks for all the responses!
posted by Ziggy Zaga at 4:58 PM on July 29, 2005


Don't bother with Stuffit. I've just been playing with the automation tool and I can't find any way for it to either flatten the archive or extract to a folder based on the archive name, rather than the contents of the archive.

There's an app called "IZarc" that I know is able to automatically put a group of files all into their own archive when compressing, which is fairly unusual. It could be that it's also flexible enough to do what you want when decompressing. I don't have it installed on this particular PC, I'm just grabbing it now.

Unlike Stuffit Deluxe, it's free.
posted by krisjohn at 5:03 PM on July 29, 2005


I can't find any way for it to either flatten the archive or extract to a folder based on the archive name

Edit > Application Options > Expansion > Create Surrounding Folder: Always.
posted by kindall at 5:07 PM on July 29, 2005


Best answer: IZarc does it in one swish move.

I built three archives; apple.zip, pear.zip and banana.zip

apple.zip had two folders, red and green, one with one file in it, on with two. pear.zip had one folder named shaped with a file in it. banana.zip had one folder named banana with another folder with two files in it.

Highlight all three zip files, right-click, select Extract to... (from the IZarc sub-menu), Uncheck "Restore Original Folders", press [Extract].

Poof!

Three folders named apple, pear and banana with no sub-folders in them and all files from the archive in one flat soup.

Enjoy.
posted by krisjohn at 5:17 PM on July 29, 2005


Response by poster: Thanks for your efforts krisjohn, IZarc seems to be the most foolproof method of doing it that I am now aware of.

I did discover that WinRAR will also extract files to individual directories, but does not flatten the directory structure.

I am liking this IZarc program though.

Thanks again to everyone who responded :)
posted by Ziggy Zaga at 5:40 PM on July 29, 2005


Actually, WinRAR also does this. Highlight whatever files you want to extract, right-click, select Extract..., then in the dialog, check Extract archives to subfolders and (in the Advanced tab) Do not extract pathnames.
posted by gentle at 2:01 PM on July 30, 2005


« Older yahoo music error   |   Reasons for Increased Hair Loss? Newer »
This thread is closed to new comments.