Compare files properly when detecting collisions