#!/bin/bash
# pcp - Prompt Copy
# copy a directroy of files to a destination, prompt to continue or abort if errors are encountered.
# Copyright (c) Humanity
eval destination=\$$#
while (( $# > 1 )); do
source="$1"; shift
find $source -type f | while read file; do
while (true); do
cp --preserve=all --no-dereference --parents "$file" "$destination";
#make sure it copied without error
if [ $? -ne 0 ]; then
echo 'An error has occured, perhaps the medium is full. Press enter to try again, or CTRL+C to quit';
read;
else
break;
fi;
done;
done;
done;
echo 'complete';
exit;