Copy Directory

Posted on 1998-09-29
Last Modified: 2010-04-06
Any easy way to copy an entire directory?
Question by:rwv
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

BoRiS earned 100 total points
ID: 1341209

try something like this...

procedure TForm1.Button1Click(Sender: TObject);
              DirInfo: TSearchRec;
              r : Integer;
              r := FindFirst('C:\Download\Test\*.*', FaAnyfile, DirInfo);
              while r = 0 do  begin
                if ((DirInfo.Attr and FaDirectory <> FaDirectory) and
                    (DirInfo.Attr and FaVolumeId <> FaVolumeID)) then
                  if CopyFile(pChar('C:\Download\test\' + DirInfo.Name))
                     = false then
                   ShowMessage('Unable to find Directory : C:\Download\test\' +
                r := FindNext(DirInfo);

This is how I would it, thou I must say I have never tried to copy the whole directory but here you go, hope this helps...


Author Comment

ID: 1341210
a recursive version of this will do subdirectories too

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Create Database on Android via Delphi dbExpress 3 144
HTML text in the body of an email (delphi code) 12 262
DBCtrlGrid, Delphi, Scroll 8 88
Posting a string with PostMessage 23 50
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question