Deleted ext

We have atool
This commit is contained in:
krisdoodle45 2021-10-10 17:01:37 +02:00 committed by GitHub
parent f7fad2bd24
commit 6dd759a259
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,45 +0,0 @@
#!/bin/sh
# A general, all-purpose extraction script. Not all extraction programs here
# are installed by LARBS automatically.
#
# Default behavior: Extract archives 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 archives into current directory rather than a new one.\\n" && exit 1 ;;
esac done
[ -z "$extracthere" ] && archives="$(realpath "$@" 2>/dev/null)" || archives="$(realpath "${@:2}" 2>/dev/null)"
[ -z "$archives" ] && printf "Give archives to extract as argument.\\n" && exit 1
while IFS= read -r file <&3; do
if [ -f "$file" ] ; then
if [ -z "$extracthere" ]; then
directory="$(echo "$file" | sed 's/\.[^\/.]*$//')" &&
mkdir -p "$directory" &&
cd "$directory" || continue
fi
case "$file" in
*.tar.bz2|*.tbz2) bsdtar -xf "$file" ;;
*.tar.xz) bsdtar -xf "$file" ;;
*.tar.gz|*.tgz) bsdtar -xf "$file" ;;
*.tar.zst) bsdtar -xf "$file" ;;
*.tar) bsdtar -xf "$file" ;;
*.lzma) unlzma "$file" ;;
*.bz2) bunzip2 "$file" ;;
*.rar) unrar x -ad "$file" ;;
*.gz) gunzip "$file" ;;
*.zip) unzip "$file" ;;
*.Z) uncompress "$file" ;;
*.7z) 7z x "$file" ;;
*.xz) unxz "$file" ;;
*.exe) cabextract "$file" ;;
*) printf "extract: '%s' - unknown archive method\\n" "$file" ;;
esac
else
printf "File \"%s\" not found.\\n" "$file"
fi
done 3<<< "$archives"