Test that file exists before removing usage.

From #6741.