Skip to content

Instantly share code, notes, and snippets.

@Arakade
Created April 29, 2016 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arakade/3f98e7dbbf332568b6ea682ee7bcef83 to your computer and use it in GitHub Desktop.
Save Arakade/3f98e7dbbf332568b6ea682ee7bcef83 to your computer and use it in GitHub Desktop.
Extract unitypackage contents from extracted directory into more normal form.
#!/bin/bash
# Extract unitypackage contents from extracted directory into more normal form.
# Rupert Key, 2014/09/15-ish
# TODO: Make it extract from the .unitypackage (tar.gz) so don't need initial extract step.
# RK: On updating, don't forget to update the public version!
# Public: If you want, please ping me with any changes / requests.
if [ $# -ne 2 -o "$1" == "-h" ] ; then
echo "Usage: $0 <source dir with extracted unityPkg contents> <destination dir>"
exit 1
fi
SD="$1"
TD="$2"
#i=2
for d in "$SD"/* ; do
pn="$(cat $d/pathname)"
bd="$(dirname "$pn")"
fn="$(basename "$pn")"
td="$TD/$bd"
if [ ! -d "$td" ] ; then
mkdir -p "$td"
fi
if [ -f "$d/asset" ] ; then
cp "$d/asset" "$td/$fn"
fi
# if [ $i -le 0 ] ; then
# exit 2 # temp
# else
# let i=i-1
# fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment