check dir before deleting