check if a directory exists before we try to remove it