+2  A: 

Check This out as a starting point

http://msdn.microsoft.com/en-us/library/aa364418(VS.85).aspx

or even better this full example

http://msdn.microsoft.com/en-us/library/aa365200(v=VS.85).aspx

renick
+1  A: 

You would basically have to write code to reproduce the functionality in xcopy. To do so, you must build a list of files by accessing the path and recursing through it. Test each found entry with your pattern and keep only those that match. Then iterate over that list with CopyFile.

See the following set of functions that can help you build the file list:

http://en.wikipedia.org/wiki/Dirent.h

It might just be easier to keep using xcopy unless you have a specific reason not to.

Amardeep
Just talked to the boss... although unable to tell me why this needs to be done, he insured me that it will be much better in the end.
Ben313
+2  A: 

You could also use SHFileOperation or IFileOperation (the latter being only available from Vista upwards but is now the recommended way according to MSDN). SHFileOperation supports wildcards and displays a progress by default, but there's also a flag for silent operation.

Check out the following MSDN links for more info:

http://msdn.microsoft.com/en-us/library/bb762164(v=VS.85).aspx

http://msdn.microsoft.com/en-us/library/bb775771(v=VS.85).aspx

humbagumba
To clarify: `SHFileOperation` is supported since the stone age; only `IFileOperation` is Vista upwards.
MSalters
Yes, that's what I meant. I guess my post was unclear in this regard. I edited it.
humbagumba
Just did this today. Ended up doing exactly what I wanted it to. Thanks a ton!
Ben313
+1  A: 

There are lots of ways to do it. I'd probably use a loop of FindFirstFile() / FindNextFile().

However, is there any reason you can't still use xcopy? You can launch it with CreateProcess(). It isn't pretty, but it works.

Michael J