A simple script that extracts various types of compressions.
Supported compressions : KGB, ARJ, PPMD, ZIP, RZIP, GZIP, BZIP2, TAR, CAB, ARC, XZ, 7z, ZOO, RAR s
Usage: ./extract.sh <filename> [-d|--directory <arg>] [-e|--exclude <arg>] [-h|--help]
<filename>: Compressed filename
-d, --directory: Specify output directory (default: '_extracted')
-e, --exclude: Exclude <FILE EXTENSION> from decompressing (empty by default)
-h, --help: Prints help
$ sudo apt-get install ppmd kgb arj rzip bzip2 cabextract nomarch zoo
Note: You may need to install ppmd and zoo packages manually.
As use cases, we can refer to
Simply give the filename and output directory name.
$ ./extract.sh pop.zip -d output-dir/
$ ls output-dir/
filler.txt flag.png
Exclude option is for ignoring side files in extraction and preventing errors in decompressing them.
$ ./extract.sh 1000.tar -d output-dir/ -e txt
$ ls output-dir/
8c4be4.gz
$ file 8c4be4.gz
8c4be4.gz: ASCII text