Something like the following in
general program mode should do the job, assuming that #file contains the exact filename.
Code:
program: ifempty(field('#file'), template('{author_sort}/{title} - {authors}'))
The same thing in
template program mode is something like
Code:
{#file:'ifempty($, template('{author_sort}/{title} - {authors}'))'}
The "something like"s are there because I don't have that column in my library so these are provided without testing.