linuxShortcuts/Dolphin/extract.sh
Bruno Fontes 42344f98a5 Tests, tests and tests
Still not sure why I keep track of those changes, if I don't need them
and do not care about proper handling them.

Anyway, it is here if, some some reason I need it back.
2022-01-22 19:14:01 -03:00

24 lines
893 B
Bash
Executable File

#!/bin/bash
file="$1"
foldername="$(echo "$file" | sed 's/\(.*\)\..*/\1/')/"
if [ -f "$file" ] ; then
case "$file" in
*.tar.bz2) tar xvjf "$file" -C "$foldername" ;;
*.tar.gz) tar xvzf "$file" -C "$foldername" ;;
*.bz2) bunzip2 "$file" "$foldername" ;;
*.rar) unrar x "$file" "$foldername" ;;
*.gz) gunzip "$file" "$foldername" ;;
*.tar) tar xvf "$file" -C "$foldername" ;;
*.tbz2) tar xvjf "$file" -C "$foldername" ;;
*.tgz) tar xvzf "$file" -C "$foldername" ;;
*.zip) unzip "$file" -d "$foldername" ;;
*.Z) uncompress "$file" "$foldername" ;;
*.7z) 7z x "$file" -o "$foldername" ;;
*) echo "'$file' cannot be extracted via >extract<" ;;
esac
else
echo "'$file' is not a valid file"
fi