David
Thu Dec 13 05:22:24 PST 2007
"Sharon" <SharonG@newsgroups.nospam> wrote in message
news:216A9E10-BC0B-4141-94B8-B19615A07CB1@microsoft.com...
> I need to find all files, in a specific directory, that there names starts
> with a specific prefix and end with a specific extension.
>
> For example:
> The directory to look in = "C:\Temp"
> The files to look for in the directory = "ABCD*.nbr"
>
> How do I accomplish that using native (unmanaged) C++?
CString sPathSpec( _T( "c:\\temp\\abcd*.nbr") );
WIN32_FIND_DATA Data;
HANDLE hFindFile;
hFindFile = FindFirstFile( sPathSpec, &Data );
if( hFindFile!=INVALID_HANDLE_VALUE )
{
do
{
/ / What you like with the contents of "Data"
} while( FindNextFile( hFindFile, &Data ) );
FindClose(hFindFile);
}
Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm