Created
May 27, 2015 14:23
-
-
Save bgerstle/0c1d1ba875644a116c7c to your computer and use it in GitHub Desktop.
Extract the "Documents" folder from one or more "xcappdata" archives into a given directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
set -e | |
declare -r OUTPUT_DIR="$1" | |
shift | |
if [[ "$OUTPUT_DIR" == "" ]]; then | |
echo "Need to specify an output directory as the first argument" | |
exit 1 | |
fi | |
mkdir -p "$OUTPUT_DIR" | |
function export_xcappdata() { | |
local path="$1" | |
local name="$(basename "${path}" | sed 's:\.xcappdata::')" | |
local outfile="${name}.zip" | |
local src="${path}/AppData/Documents" | |
echo "Zipping ${src} to ${OUTPUT_DIR}${outfile}" | |
pushd "$src" > /dev/null | |
zip -r "${outfile}" . | |
popd > /dev/null | |
mv "${src}/${outfile}" "${OUTPUT_DIR}" | |
} | |
for f do | |
export_xcappdata "$f" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment