Using shell script, right?
All you really need to do is check the return status of cp - if there is a problem, it will return non-0. I do a little paranoid checking of the second arg too in this example (not tested)
Code:
mycp () {
# arg 1 is filename, arg #2 is target directory
# verify $2 is actually a directory, just for paranoia
if [ ! -d "$2" ]; then
echo "Error in mycp... $2 is not a directory" 1>&2
return 1
fi
cp "$1" "$2"
status=$?
if [ "$status" -ne 0 ]; then
echo "Error in mycp copying file $1 to directory $2 returned status $status"
return $status
else
return 0
fi
}
If you want to be uber-paranoid in your verification, you could checksum the file before copying, and after, and compare the checksums.