Thread: CopyFile With Wildcards?

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    18

    CopyFile With Wildcards?

    I am sure I have used the equivalent function in .NET to do this but on Visual C++ 6 it doesn't like me trying to copy files using a wildcard to a new directory.

    Like:

    ::CopyFile("C:\\test\\test*.txt", "C:\\new\\" FALSE);

    Does this not work in VC6? If not what alternatives are there?
    Last edited by Jonnster; 11-25-2010 at 04:50 AM.

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Use this - FindFirstFile Function (Windows)

    Then call CopyFile on each

  3. #3
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    639
    SHFileOperation takes wildcards in it params, the strings must be double-null terminated though.
    Last edited by adeyblue; 11-25-2010 at 10:23 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Files and wildcards
    By MacNilly in forum C Programming
    Replies: 3
    Last Post: 08-11-2007, 03:42 PM
  2. Trying to get my App to copy files with wildcards
    By Dwizard in forum Windows Programming
    Replies: 3
    Last Post: 09-30-2005, 05:49 PM
  3. CopyFile()
    By magic in forum Windows Programming
    Replies: 7
    Last Post: 09-22-2003, 11:56 PM
  4. extracting files from a rar/zip
    By jverkoey in forum Windows Programming
    Replies: 2
    Last Post: 03-28-2003, 08:55 AM
  5. Wildcards, again
    By Echidna in forum Windows Programming
    Replies: 2
    Last Post: 12-11-2001, 12:41 AM