xvoland / extract Goto Github PK
View Code? Open in Web Editor NEWBash/Zsh function for extract: .zip, .rar, .bz2, .gz, .zlib, .tar, .tbz2, .tgz, .Z, .7z, .xz, .exe, .tar.bz2, .tar.gz, .tar.xz, etc.
License: MIT License
Bash/Zsh function for extract: .zip, .rar, .bz2, .gz, .zlib, .tar, .tbz2, .tgz, .Z, .7z, .xz, .exe, .tar.bz2, .tar.gz, .tar.xz, etc.
License: MIT License
Hi,
Just wanted to request adding zlib support. Sorry if this isn't the right way to ask. I came across my first .zlib file. There is a tool called zlib-flate, installed as part of qpdf that works - http://manpages.ubuntu.com/manpages/trusty/man1/zlib-flate.1.html - but of course it would be handy to have it within extract :)
Thank you
Sorry, don't know how to pull-request, but DMG (Apple Disk iMaGe, like an ISO) is an archive format that can be opened with 7z, so I just added it to the case statement:
.7z|.dmg)
Since commit 2f89a4a and the "make dir" removal the function gives invalid compressed file path to uncompression programs. ../"$1"
should be either transformed to "$1"
or turned into a variable (path
for instance) :
local path="$1"
# local basename=${1%.*}
# mkdir $basename && cd $basename
# path="../$1"
Today I ran:
extract *.zip
but it extracted only the first archive.
Would it be possible to incorporate multiple files extraction?
If .tar not compressed whith gzip:
zip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
touch hello.txt
tar -cvf foo.tar hello.txt
tar -czvf foo2.tar hello.txt
file foo*
foo.tar: POSIX tar archive (GNU)
foo2.tar: gzip compressed data, from Unix, original size modulo 2^32 10240
Would you accept patches to make this executable instead?
I am locally making it "executable", but
Lines 4 to 5 in dda4c33
I think that 42c38af should be solved "externally" [i.e. user is responsible to give a correct path], rather you trying to "mask" it.
Would you be interested in adding to this a nodejs npm package, so that it can be easier to install globally? (basically a helper for workstation stuff)
I suppose it would be installed via:
npm install -g extract-cli
Hi,
This extractor works great but if the filename has a space character it fails to extract even if I use "
or '
.
It says file not exists because it tried to use only the sup before the first space.
If it's not possible due to bash limitation it would be helpful to mention it in README.
Awesome Requirements Fulfilled with this Extractor.
Are there any Workarounds to have a logs file to save logs in /var/log directory? Thanks in advance if you can help here.
Hello correct me if I'm wrong but,
PATH=script_dir/extract.sh:$PATH
seems highly irregularI propose to change the README.md
so that the installation step of adding the file to path is:
export PATH="<path_to_file>":"$PATH"
("$PATH"
so that any possible preexisting spaces in the path are properly escaped)
and that the extract.sh
has an additional line:
extract "$@"
While I'm sure it works most of the time, what about files which don't have a traditional extension, or one at all?
EDIT:
Okay, basically, this is what I had in mind. Thought I'd just write it myself as I figured it would be pretty neat:
https://github.com/terminalforlife/miscellaneous/blob/dev/unpack
Do you think this approach is something you would consider incorporating into your function?
in tar version of 1.26, extract a .tar file with tar zxvf have error of
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
and .tar file must extract with tar xvf
in version of 1.26
better for MSI files
The README.md does specify the MIT license, but you should include the license text since the MIT license requires it be provided in order for others to use your code:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Preferably, it should be in a separate LICENSE file. Plus, GitHub will give you a nifty little icon in the top commit bar, if you do use a LICENSE file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.