Solved

Copy Directory

Posted on 1998-09-29
2
216 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

Technology Partners: 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
Printing problem 2 110
Dev express lookupcombo 3 44
RESTRequest Parameter 4 51
IP without any Dots 1 51
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

713 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