```mkdir -p``` to avoid this failing? or make sure before the loop that tmp is not there.

Just in case the command below fails before cleaning up the tmp dir.