Solved

Copy Directory

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 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