List of fallback values in SQL
The simplest solution I can think of is to simply have a table folders with two columns: folder and priority. Simply

select folder
from folders
order by priority;


Then just try them in order and use the first folder that exists as a physical directory.

If folder in your current model is an attribute, then make the folders table a child table of that table; ie, if your current model is:

x (
   id,
   col1,
   col2,
   folder
)


then you should turn that into:

x (
    id,
    col1,
    col2
 )

 folders (
     x_id references x,
     folder,
     priority
  )


and the query becomes:

 select folder
 from folders
 where x_id = &lt;id&gt;
 order by priority;