It is common to write some information out to a file to be used on a
subsequent run. But when it is time to read the file again, you only
want to do so if the file actually exists. \testfileexistence
is given an argument which is appended to \jobname
,
and sets the conditional \iffileexists
appropriately.
For example:
\testfileexistence{toc}% \iffileexists \input \jobname.toc \fi