Skip to content

Instantly share code, notes, and snippets.

@killerswan
Created January 11, 2012 01:58
Show Gist options
  • Save killerswan/1592501 to your computer and use it in GitHub Desktop.
Save killerswan/1592501 to your computer and use it in GitHub Desktop.
use unar to extract ZIP files on MacOS sensibly
#!/bin/bash
# Kevin Cantu, January 2012
me="$(basename "$0")"
function uzi () {
if [ ! -r "$1" ]
then
echo "${me}: \"$1\" is not a readable file" > /dev/stderr
return
fi
# whacks the resource fork by expanding it to other directories
# unzip -d "${1}-expanded" "$1"
# can't have the output folder named?
# open -a "Archive Utility" "$1"
# unar beta 0.2 from http://code.google.com/p/theunarchiver/
# unar -forks fork "$1" "${1}-expanded"
#
# unar 0.99
unar -forks fork -o "${1}-expanded" "$1"
}
for x in $*
do
uzi "$x"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment