#!/bin/sh

if [ $# -eq 1 ]; then
	outDir="${1}"
	if [ ! -e "${outDir}" ]; then
		mkdir "${outDir}"
		pax -r -w -L -s ',^Lin/Mod/gen-.*,,' -s ',^Lin/Rsrc.*,,' `ls -p | grep -E "^[A-Z].+\/$" | grep -v "^${outDir}\/$"` run-BlackBox blackbox* BlackBox* "${outDir}"
	else
		echo "${outDir}: already exists"
		exit 2
	fi
else
	echo "usage: `basename $0` outputDirectory"
	exit 1
fi
