Check if dir is empty before deleting to prevent warning.