file mask

wildcard string matches

function FileMatchesMask(fmask,fname:string):boolean;

   where

       fmask would be something like:  '*xyz??.ab?'
       fname would be the filename,
       and the result would be

         for

        axyz.abc            true
        abcxyz12.ab         true
        xyz12.abc           true

       ... and so on ...

Oh, and, it should support longnames, too! <g>
-----
Can' you use the FindFirstFile and FindNextFile functions for this ? They support masks as well.
-----
Also, Have you had a look at TMask (in D3 don't know about D1 or D2).

function FileMatches(Mask, FName: String): Boolean;
var
     MyMask: TMask;
begin
     MyMask := TMask.Create(Mask);

     Result := MyMask.Matches(FName)
end;