#!/bin/sh # # ~/.config/rox.sourceforge.net/SendTo/Extract # Extract -- script for the ROX-Filer "Send To..." menu that # replicates the "Extract here" function found in other # file managers. # Copyright (C) 2009 anrxc # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 function extract() { if [ -f "$1" ] ; then case "$1" in *.tbz2 | *.tar.bz2) tar -xvjf "$1" ;; *.txz | *.tar.xz) tar -xvJf "$1" ;; *.tgz | *.tar.gz) tar -xvzf "$1" ;; *.tar | *.cbt) tar -xvf "$1" ;; *.zip | *.cbz) unzip "$1" ;; *.rar | *.cbr) unrar x "$1" ;; *.arj) unarj x "$1" ;; *.ace) unace x "$1" ;; *.bz2) bunzip2 "$1" ;; *.xz) unxz "$1" ;; *.gz) gunzip "$1" ;; *.7z) 7z x "$1" ;; *.Z) uncompress "$1" ;; *) xmessage -center "Failed to extract '$1'" ;; esac else xmessage -center "'$1' is not a valid file for extraction" fi } cd $(dirname "$1") extract "$@"