Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to copy a complete cd to a folder on harddrive and give some feedback?

Posted on 2006-11-01
2
Medium Priority
?
169 Views
Last Modified: 2010-04-05
Hi there!

I would like my program to calculate the total size of the files and folders present on the cdrom as well as number of files and folders, then copy the entire cdrom to a folder on harddrive and report if success or fail.

Kind regards,

Paul
0
Comment
Question by:PeterdeB
[X]
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
2 Comments
 

Author Comment

by:PeterdeB
ID: 17851850
Something like this..thanks to Madshi I believe :)

procedure CopyDir(FromDir, ToDir : string);
var
 FOS :tSHFileOpStruct;
begin
  FromDir := Trim(FromDir);
  if FromDir[Length(FromDir)] <> '\' then FromDir := FromDir + '\';
  ToDir := Trim(ToDir);
  with FOS do
  begin
    Wnd := Application.Handle;
    wFunc := FO_COPY;
    pFrom := PChar(FromDir + '*.*' + #0);
    pTo := PChar(ToDir + #0);
    fFlags := FOF_ALLOWUNDO or FOF_MULTIDESTFILES or FOF_NOCONFIRMMKDIR;
  end;
  SHFileOperation(FOS);
end;

// usage:
procedure TForm1.Button1Click(Sender: TObject);
begin
  CopyDir('c:\tools','d:\tools');
  CopyDir('a:\', 'c:\archive');
end;
0
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 2000 total points
ID: 17854016
http://www.awitness.org/delphi_pascal_tutorial/source/directory_search_recursive.html
you can also look in folder recursively if you want to make a dialog showing "File ......xxxx..... being copied"

For total size of the CD you can use DiskSize function, DiskSize(i) where i=
1 = A drive
2 = B drive
3 = C drive
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

618 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