![]() *.tgz) /usr/bin/tar xzf "$1" -C "$directory/$filenameWithoutExt" *.tbz2) /usr/bin/tar xjf "$1" -C "$directory/$filenameWithoutExt" *.tar) /usr/bin/tar xf "$1" -C "$directory/$filenameWithoutExt" *.rar) /usr/bin/rar x "$1" "$directory/$filenameWithoutExt" *.bz2) /usr/bin/bunzip2 "$1" -C "$directory/$filenameWithoutExt" *.tar.gz) /usr/bin/tar xzf "$1" -C "$directory/$filenameWithoutExt" *.tar.bz2) /usr/bin/tar xjf "$1" -C "$directory/$filenameWithoutExt" usr/bin/mkdir "$directory/$filenameWithoutExt" # Bash Function To Extract File Archives Of Various Types # echo "filenameWithoutExt: $filenameWithoutExt" Depending on whether thats all youre looking for. Root=$temp # There are multiple files or there is a non-directory RarZilla Free Unrar is a great little utility for automatically opening RAR archive files, but it doesnt do much else. *) archive=$PWD/$archive # make absolute pathĮcho >&2 "Target $target already exists, aborting."Ĭase "$member" in */.|*/.) continue esac Otherwise $2 contains all the files at the root of the # archive contains a single top-level directory, that directory # Extract the archive $1 to a directory $2 with the program $3. Spain.rar to a new directory called Spain, except that if all the files in Spain.rar are already under the same top-level directory, then this top-level directory is kept. I have a script in my personal archive that does exactly this.
0 Comments
Leave a Reply. |