diff options
author | Marvin Borner | 2020-06-11 14:53:23 +0200 |
---|---|---|
committer | Marvin Borner | 2020-06-11 14:53:23 +0200 |
commit | cfc61f4fa5a5b2236439ec1ebe416f23e31d8092 (patch) | |
tree | 96f4fd5f4d57e6835dd6f105caca30c65d7160e5 /.scripts/ext | |
parent | d05b17617eb83377f980c24f29079229697504cc (diff) |
Soo many features added
weeee so much efficiencyyyy
Diffstat (limited to '.scripts/ext')
-rwxr-xr-x | .scripts/ext | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/.scripts/ext b/.scripts/ext new file mode 100755 index 0000000..4b85f88 --- /dev/null +++ b/.scripts/ext @@ -0,0 +1,29 @@ +#!/usr/bin/env sh + +archive="$(readlink -f "$*")" && + directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && + mkdir -p "$directory" && + cd "$directory" || exit + +[ "$archive" = "" ] && printf "Give archive to extract as argument\\n" && exit + +if [ -f "$archive" ]; then + case "$archive" in + *.tar.bz2 | *.tbz2) tar xvjf "$archive" ;; + *.tar.xz) tar -xf "$archive" ;; + *.tar.gz | *.tgz) tar xvzf "$archive" ;; + *.lzma) unlzma "$archive" ;; + *.bz2) bunzip2 "$archive" ;; + *.rar) unrar x -ad "$archive" ;; + *.gz) gunzip "$archive" ;; + *.tar) tar xvf "$archive" ;; + *.zip) unzip "$archive" ;; + *.Z) uncompress "$archive" ;; + *.7z) 7z x "$archive" ;; + *.xz) unxz "$archive" ;; + *.exe) cabextract "$archive" ;; + *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;; + esac +else + printf "File \"%s\" not found\\n" "$archive" +fi |