Unique pattern mask for FindFirst


This might be a silly question, but when using FindFirst and FindNext I need to have a unique type of pattern mask.  

The ap I am writing has to search through multiple directories searching for files which do not contain a numeric character (0 - 9) as the second character in the filename.

90% of the files will look like A100363_.tif or T100363_.tif.  They are files which have been processed, but the rest of the files are named with people's names.  Nearly all the names are in the middle of the Dir listing except for those after and including the letter T.

Is there a way to find just the files named after people?  I do not want to copy them to another folder to do it.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this

Function MyFiles( Path : String ; Attr : Word) : TStringList ;
  FList : TStringList ;
  SRec  : TSearchRec;
  FList := TStringList.Create ;
  FList.Clear          ;
  FList.Sorted := True ;    { this line is optionally }

  if FindFirst(Path,Attr,SRec) = 0  then begin
     if not (SRec.Name[2] in ['0'..'9']) then
        FList.Add(SRec.Name) ;
     while FindNext(SRec) = 0 do
       if SRec.Name[2] in ['0'..'9'] then
          FList.Add(SRec.Name) ;

  MyFiles := FList ;

  FList.Free ;

and I am sure that this function will return list of files, that not contain a numeric character as the second character in the filename. You can use Path and Attr as an additonal constrains.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I made a mistake in condition for FindNext. The correct line is :

While FindNext(sRec) = 0 do
  if not (SRec.Name[2] in ['0'..'9']) then
   FList.Add(SRec.Name) ;
jdthedjAuthor Commented:
Hi Victor - thanks for the reply.  That is an excellent way to do it!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.