3 ms·
I highly recommend using atool[1], and never worrying about extracting archives again. It's a wrapper around basically every compression/archive tool in remotel
by pdkl95 11y ago
I highly recommend using atool[1], and never worrying about extracting archives again. It's a wrapper around basically every compression/archive tool in remotely common use.
Bonus: it decompresses to a safely-named subdirectory, but moves the contents of that subdirectory back to the current directory if the archive contained exactly one file. Highly convenient without any risk of accidentally expanding 1000 files into the current directory.
After creating this macro, I've basically never had to care about how to decompress/unarchive anything.
# 'x' for 'eXpand'
alias xx='command atool -x'
# use
% cd $UNPACK_DIR # (optional) (can be the PARENT dir)
% xx foo.zip # or .tar.{gz,xz} or whatever
foo.zip: extracted to `foo' (multiple files in root)
% cd foo/
% ls | wc -l
3
atool actually has many other useful features, but it's worth it just for the extractor.
[1] http://www.nongnu.org/atool/ http://www.nongnu.org/atool/
- chx 11y agoLooks awesome by description but last release is from 2012 which makes me worried slightly.
- pdkl95 11y agoOld doesn't mean bad. Sometimes, it means "finished". About the only thing that a small would need to be updated at this point is support for a new compressor. (that 2012 release mainly added suppport for plzip)
- lqdc13 11y agoThere are usually issues in compatibility between linux zip utility and the mac one. Has to do with zip not being backward compatible. How does atool deal with cases where there are two versions of the same extractor?
- pdkl95 11y agoI'm not familiar with that issue, but you can set the path to any extractor in /etc/atool.conf or ~/.atoolrc # ~/.atoolrc path_zip /path/to/preferred/bin/zip See atool(1) for details. http://linux.die.net/man/1/atool http://linux.die.net/man/1/atool As far as I know, different zip formats are not auto-detected. However, it does (optionally) use file(1) to detect the file format, which can be overridden with the 'path_file' option, so a hack may be possible?
- vbezhenar 11y agoFor OS X and macports I use p7zip package which intalls 7z command. It understand .zip, .rar, of course .7z and probably other formats. I wrote simple Automator script to use that command from Finder and it works just fine (actually .zip and .tar.gz formats are supported by OS X archive tool, but .rar is not and I often have to deal with that format).