summaryrefslogtreecommitdiffstats
path: root/.scripts/extract
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-11-05 17:51:24 -0500
committerLuke Smith <luke@lukesmith.xyz>2018-11-05 17:51:24 -0500
commit2f4c2a68a1cbebb0e06a5b3296e4bbb575c5fcb2 (patch)
tree4adda53569104861794d990ef99c85edc1ae2d8c /.scripts/extract
parentcd667e6aa111c86b40b9e3104605953e9b341332 (diff)
downloadeibhear-2f4c2a68a1cbebb0e06a5b3296e4bbb575c5fcb2.tar.gz
eibhear-2f4c2a68a1cbebb0e06a5b3296e4bbb575c5fcb2.tar.zst
eibhear-2f4c2a68a1cbebb0e06a5b3296e4bbb575c5fcb2.zip
scripts sorted
Diffstat (limited to '.scripts/extract')
-rwxr-xr-x.scripts/extract41
1 files changed, 0 insertions, 41 deletions
diff --git a/.scripts/extract b/.scripts/extract
deleted file mode 100755
index c214583..0000000
--- a/.scripts/extract
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-# A general, all-purpose extraction script.
-#
-# Default behavior: Extract archive into new directory
-# Behavior with `-c` option: Extract contents into current directory
-
-while getopts "hc" o; do case "${o}" in
- c) extracthere="True" ;;
- *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit ;;
-esac done
-
-if [ -z "$extracthere" ]; then
- archive="$(readlink -f "$*")" &&
- directory=${archive%.*} &&
- mkdir -p "$directory" &&
- cd "$directory" || exit
-else
- archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)")"
-fi
-
-[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit
-
-if [ -f "$archive" ] ; then
- case "$archive" in
- *.tar.bz2|*.tar.xz|*.tbz2) tar xvjf "$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