dtrx: Intelligent archive extraction
Introduction
dtrx stands for “Do The Right
Extraction.” It's a tool for Unix-like systems that takes all the
hassle out of extracting archives. Here's an example of how you use
it:
$ dtrx linux-2.6.10.tar.bz2
That's basically the same thing as:
$ tar -jxf linux-2.6.10.tar.bz2
But there's more to it than that. You know those really annoying files
that don't put everything in a dedicated directory, and have the
permissions all wrong?
$ tar -zvxf random-tarball.tar.gz
foo
bar
data/
data/text
$ cd data/
cd: permission denied: data
dtrx takes care of all those problems for
you, too:
$ dtrx random-tarball.tar.gz
$ cd random-tarball/data
$ cat text
This all works properly.
dtrx is simple and powerful. Just use the
same command for all your archive files, and they'll never frustrate you
again.
Features
- Handles many archive types: You only need to remember
one simple command to extract
tar,
zip,
cpio,
deb,
rpm,
gem,
7z,
cab,
gz,
bz2, and
lzma files.
If they have any extra compression, like tar.bz2, dtrx will take
care of that for you, too.
- Keeps everything organized: dtrx will make sure that archives are extracted into
their own dedicated directories.
- Sane permissions: dtrx makes
sure you can read and write all the files you just extracted, while leaving
the rest of the permissions intact.
- Recursive extraction: dtrx can
find archives inside the archive and extract those too.
Download
Download dtrx
6.0. The SHA1 checksum for this file
is dbe0211c90d6d03035f612fe31f96c825aa75274. New features in this
release include:
- When you specify -v at the command
line, dtrx will display the files it
extracts, much like tar.
- When dtrx prompts you about how to handle
recursive archives, you now have the option of listing what those
archives before making a decision.
- dtrx will now provide more information about
why a particular extraction attempt failed. It will show you error
messages from all the attempts it made, rather than only the last error
it got. It will also detect and warn you when one of the underlying
extraction tools, like cabextract, cannot be
found.
- dtrx does a better job of cleaning up after
itself. It wouldn't always clean up temporary files after certain
errors; that has been fixed. It also catches SIGINT and SIGTERM and
cleans up before finishing execution.
- Version 5.0 introduced a regression such
that dtrx would not offer to extract
recursive archives that were hidden under subdirectories. Version 6.0
fixes that.
Requirements
If you have Python 2.4 or greater, this should work out of the box. If
you're stuck on Python 2.3, you can use this if you install the subprocess module.
You'll need the usual tools for the archive types you want to extract: for
example, if you're extracting zip files, you'll
need zipinfo and unzip.
Installation
You can just put scripts/dtrx wherever is
convenient for you, but if you want to install the program system-wide, you
can also run the following command as root or equivalent:
python setup.py install
See the included INSTALL file for more information.