0.2.8 GPL (GNU General Public License)    
2.8/5 24
Unarc software can unpack archives into their own directory.




Sometimes when you unpack a .tar.gz file, it spills files all over your current directory, so you have to make a new directory to unpack in if you want to avoid a mess. But other .tar.gz files have their own top-level directory, so unpacking in a new directory is not necessary and creates a different kind of mess.

The answer is unarc, which unpacks an archive and creates a top-level directory if it's needed. Unarc works with lots of archives, not just tarballs - .tar.bz2, .zip and even .rpm are supported. It's a simple and tidy way to unpack most archives.

There is a companion program arcdir which provides a uniform way to archive directories into tarfiles, zipfiles and so on. It should be easy to add support for new filetypes and archivers.


unarc filename(s)

Unpack the archives specified, each into its own directory. The archiver to use is chosen based on the filename.

arcdir directory(s)

Archive each directory individually, using the default archive type tar.bz2. Each directory will be archived into dirname.tar.bz2.

arcdir -t type directory(s)

where type is one of zip, tar.gz, etc.

Archive directories into a type of archive you choose. For example, arcdir -t zip foo will archive foo/ into foo.zip.




Copy unarc and arcdir to somewhere in your PATH. They use the library archive_types.pl, which you need to copy to your Perl library directory. To find out where Perl looks for libraries, try this:

perl -e 'print "$_n" foreach @INC'

and copy archive_types.pl to one of the directories listed, /usr/lib/perl5/site_perl/5.x/ would be a good choice. Alternatively, create your own directory for Perl libraries and add it to PERL5LIB. (I'm still looking for a better way to do this, or at least a better way to explain it.)

To unpack some of the more esoteric archive types you will need to first install the program pip which works around the fact that some programs (like unzip) cannot read their input from stdin.

There is a test suite included. Try this (with archive_types.pl in the current directory):

perl archive_types.pl --test-archivers | grep -E 'ok|fail|skip'

and check that nothing fails. You may get complaints from cpio about 'truncating inode number', they can be safely ignored.

The list of archivers supported (and these instructions) assume that you have the GNU utilities on your system, rather than the plain old Unix or BSD versions. However it shouldn't be too difficult to change things to support non-GNU archivers.

What's New in This Release:

This fixes a possible infinite loop when unpacking on some systems.
Last updated on September 28th, 2007

0 User reviews so far.