Solved

Copy Directory

Posted on 1998-09-29
2
213 Views
Last Modified: 2010-04-06
Any easy way to copy an entire directory?
0
Comment
Question by:rwv
2 Comments
 
LVL 4

Accepted Solution

by:
BoRiS earned 100 total points
ID: 1341209
rwv

try something like this...

procedure TForm1.Button1Click(Sender: TObject);
            var
              DirInfo: TSearchRec;
              r : Integer;
            begin
              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\' +
                               DirInfo.Name);
                r := FindNext(DirInfo);
              end;
            end;

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...

Later
BoRiS
0
 

Author Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now