[fpc-pascal] Finding long file names

James Richters james at productionautomation.net
Thu Oct 5 01:48:58 CEST 2017

I'm trying to use findfirst()/findnext to obtain a list of files.  Here's my code:
If FindFirst(Searchfile, FAAnyfile-FAHidden, FileDirInfo)=0 then

It finds most files, even ones with really long file names, however it can't find files with periods in the file name, 
So it will find:
This is a TEST.Tap

But it will not find:

If I change my search string to:

Then it DOES find the files with more than one period in them... along with everything else.

I could filter them out myself I suppose, but that seems to defeat the way findfirst is supposed to work.

Any ideas how to make this work?  Is there a better method to use than findfirst() ?

I notice that if I use Extractfileext() with This.is.a.TEST.tap it correctly returns '.tap' as the extension.  Maybe findfirst is an obsolete way of listing the files?    Or maybe it just never got fixed to handle valid files with more than one period? 

Any thoughts on this?


More information about the fpc-pascal mailing list