Due to the call to create the destination directory
via 'mkdir -p "$(dirname "$to")"', the copy_file_to_location
function requires a filename and not the directory as a
destination.
Use copy_file_to_location as it appears to be intended and
check the exit status from the `cp' invocation for failures.