My personal archive extractor. it's a bash script that simply creates a directory and extract the archive file in int and it supports most of the archive filetypes:
#!/bin/bash
file="$1"
SCRIPTNAME="${0##*/}"
err() {
printf >&2 "$SCRIPTNAME: $*\n"
exit 1
}
file="$(readlink -f "$file")"
mkdir "$file-extDir" 2>/dev/null
dir="$file-extDir"
case "$file" in
*.tar.bz2) tar -xjf "$file" -C "$dir" ;;
*.tar.gz) tar -xzf "$file" -C "$dir" ;;
*.tar.lz) tar --lzip -xvf "$file" -C "$dir" ;;
*.bz2) bunzip2 "$file" ;;
*.rar) unrar x "$file" ;;
*.gz) gunzip "$file" ;;
*.tar) tar xf "$file" -C "$dir" ;;
*.tbz2) tar xjf "$file" -C "$dir" ;;
*.tgz) tar xzf "$file" -C "$dir" ;;
*.zip) unzip "$file" -d "$dir" ;;
*.Z) uncompress "$file" ;;
*.7z) 7z x "$file" -o"$dir" ;;
*.iso) 7z x "$file" -o"$dir" ;;
*) echo "'$file' cannot be extracted by $SCRIPTNAME" ;;
esac
you can make an alias for it in your .bashrc or .zshrc files like so
alias x='/home/mosaid/path/to/extract.sh'
it works great with ranger file manager. all you have to do is add the following line to ~/.config/ranger/rc.conf
map xx shell ${HOME}/path/to/extract.sh %s
Related Articles
Categories
Courses
- Maths
- 1APIC
- 3APIC
- Tronc Commun Sciences
- Tronc Commun Lettres
- 1 BAC Science
- 1 BAC Science Maths
- 1 Bac Lettre
- 2 Bac Science
- 2 Bac Science Maths
- Discussions
- Physics
- 1 BAC Science
- SVT
- 3 Année Collège
- Tronc Commun Sciences
- 1 BAC Science
- 1 BAC Science Maths
- 1 Bac Lettre
- 2 Bac Science
- Latex
- Templates
- Figures
Most Recent Articles
Most Viewed Articles
0 Comments, latest
No comments.