Link to home
Start Free TrialLog in
Avatar of fredop
fredop

asked on

CopyFile in VC++

Hi,
Could someone tell please tell me if there is any way of using CopyFile (or is there a similar funciton)  that I can use to copy files with "*.ini" (*.*, etc)?
i.e.
copyfile("c:\\temp\\*.ini","d:\\dest");

or, will I have to write a function to do this?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of plaroche
plaroche

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of plaroche
plaroche

Written quickly I'd do something like this:

HANDLE          hFile;
WIN32_FILE_DATA data;
BOOL            bContinue = TRUE;

hFile = FindFirstFile("*.ini", &data);
if( hFile != INVALID_HANDLE_VALUE )
  bContinue = FALSE;
while(bContinue) {
  CopyFile(data.cFileName, "c:\temp\");
  bContinue = FindNextFile(hFile, &data);
}
Avatar of fredop

ASKER

Thanks,
That's what I'll  do.
Written quickly I'd do something like this:

HANDLE          hFile;
WIN32_FILE_DATA data;
BOOL            bContinue = TRUE;

hFile = FindFirstFile("*.ini", &data);
if( hFile != INVALID_HANDLE_VALUE )
  bContinue = FALSE;
while(bContinue) {
  CopyFile(data.cFileName, "c:\temp\");
  bContinue = FindNextFile(hFile, &data);
}