Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8944491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:02:08+00:00 2026-06-15T12:02:08+00:00

I’m trying to copy all database files over from a previous installation to a

  • 0

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.

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 Exec() to run it through command line, but it would just freeze the installation.

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.

TFileStream.Create()

    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;

FileCopy()

    FileCopy('C:\Users\seang\Desktop\Old\*.mdb', 'C:\Users\seang\Desktop\New\*.mdb', True);

Command Line

    Exec('cmd.exe', 'COPY "C:\Users\seang\Desktop\Old\*.mdb" "C:\Users\seang\Desktop\New\*.mdb"', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:02:09+00:00Added an answer on June 15, 2026 at 12:02 pm

    You need to use FindFirst, FindNext, and FindClose to iterate through the folder. You get each database name, and then copy it individually. An example of doing that in Pascal (Delphi) can be found here. There’s also an example of using them in the InnoSetup help file, in the Support Functions Reference section on File System Functions:

    // This example counts all of the files (not folders) in the System directory.
    var
      FilesFound: Integer;
      FindRec: TFindRec;
    begin
      FilesFound := 0;
      if FindFirst(ExpandConstant('{sys}\*'), FindRec) then begin
        try
          repeat
            // Don't count directories
            if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then
              FilesFound := FilesFound + 1;
          until not FindNext(FindRec);
        finally
          FindClose(FindRec);
        end;
      end;
      MsgBox(IntToStr(FilesFound) + ' files found in the System directory.',
        mbInformation, MB_OK);
    end;
    

    You can change the loop above to look in the proper old folder for each *.mdb (in the FindFirst call) and change the line that counts to a block that copies each file found into the new folder (using either FileCopy or a TFileStream, whichever you prefer).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I have an array which has BIG numbers and small numbers in it. I
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a view passing on information from a database: def serve_article(request, id): served_article

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.