@lucamar
I copied down the program you pointed out in your reply #1.
I don't think it works right. Always returns the same file.
That is by design of
that specific program. I told you how to modify it
in this other post.
But if that other solution you found works, that's OK. It could be made more compact and more platform-aware (p.e. using
AllFilesMask instead of
'*.*') but it's not bad.
Some hours laterOK, it being Sunday and I being bored, I've spent a little time writing a little control for you. It's a simple
TListBox descendant with some added properties:
Directory,
FileMask,
Recurse, etc.
To search for a file/files in a directory you just have to do:
FindFilesBox.Active := False;
FindFilesBox.Directory := MyDirectory;
FindFilesBox.FileMask := MyFileName;
FindFilesBox.Active := True;
or, alternatively, use the handy built-in method:
FindFilesBox.FindFilesIn(MyDirectory, MyFilename, Recursing);
Since it's not (yet) in a package it can't be installed in the IDE: you need to instance it at run-time. I've added a small demo project to the attached zip to show how it can be used.
Have fun!