in reply to Finding if files exist when names randomly have letters in both upper and lower cases
not sure if this is a viable solution for you:
given a file name "TEST" (from the db), the simple *NIX command ls -l [Tt][Ee][Ss][Tt] would work. There's probably a better way, but that springs to mind off the top of my head.