Search for the file only if necessary