On Wed, 4 Oct 2017, James Richters wrote:

I'm trying to use findfirst()/findnext to obtain a list of files.  Here's my 
code:
Searchfile:=Tap_Drive+Tap_Path+'\'+Tap_SubDirectory+'\*.TAP';
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:
This.is.a.TEST.tap

If I change my search string to:
Searchfile:=Tap_Drive+Tap_Path+'\'+Tap_SubDirectory+'\*.*';

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?


Findfirst is definitely the way.

If this is on windows, then you've probably found a bug in findfirst/findnext.
Strange that this would go unnoticed for so long.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to