mirror of
https://github.com/brunofontes/linuxShortcuts.git
synced 2024-11-27 18:11:26 +00:00
Bruno Fontes
42344f98a5
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.
24 lines
893 B
Bash
Executable File
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
|
|
|