title: Inno Setup - FileCopy use wildcard character in pathname
body: <p>I'm trying to copy all database files over from a previous installation to a new installation, which has a new pathname.  The problem is that the installer will not know the names of the database files, so I'm trying to use a wildcard character.</p>
  
  <p>I tried using TFileStream.Create(), but this was searching for a single file, such as "*.mdb", and I kept getting an error saying it couldn't find that file.  I also tried using FileCopy(), but it seems to simply fail and move on.  I even tried using <a href="https://www.jrsoftware.org/ishelp/topic_isxfunc_exec.htm" rel="nofollow noreferrer"><code>Exec()</code></a> to run it through command line, but it would just freeze the installation.</p>
  
  <p>I've searched online a long time for an answer and read through a lot of the documentation.  I just need to know how I can use a wildcard character to copy files with unknown names.  Below are examples of what I've tried.</p>
  
  <p>TFileStream.Create()</p>
  
  <pre><code>    OldDBs := 'C:\Users\seang\Desktop\Old\*.mdb';
      NewDBs := 'C:\Users\seang\Desktop\New\*.mdb';
      SourceDB:= TFileStream.Create(OldDBs, fmOpenRead);
      DestDB:= TFileStream.Create(NewDBs, fmCreate);
      DestDB.CopyFrom(SourceDB, SourceDB.Size);
      SourceDB.Free;
      DestDB.Free;
  </code></pre>
  
  <p>FileCopy()</p>
  
  <pre><code>    FileCopy('C:\Users\seang\Desktop\Old\*.mdb', 'C:\Users\seang\Desktop\New\*.mdb', True);
  </code></pre>
  
  <p>Command Line</p>
  
  <pre><code>    Exec('cmd.exe', 'COPY "C:\Users\seang\Desktop\Old\*.mdb" "C:\Users\seang\Desktop\New\*.mdb"', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
  </code></pre>