Skip to content

Instantly share code, notes, and snippets.

Created May 6, 2011
What would you like to do?
This script unzips a kmz file by renaming it to .rar and then calling unzip on it.
# Author: Nick Dunn
# This script takes as input the path to a .kmz file and outputs a directory
# full of the contents of that .kmz file, named the same as the .kmz file without
# the kmz suffix. Thus
# ./ /path/to/mykmz.kmz
# would result in a new directory being created at /path/to/mykmz filled with the contents
# of mykmz.kmz.
if [ $# -ne 1 ]
echo "Syntax: $0 <kmzfilepath>"
type -P unzip &>/dev/null || { echo "I require unzip but it's not installed. Aborting." >&2; exit 1; }
# name without extension
echo "Copying $1 to $with_rar_ext"
cp $1 $with_rar_ext
echo "Unzipping"
unzip $with_rar_ext -d $base_name
echo "Cleaning up"
rm $with_rar_ext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment