Solved

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

Posted on 2006-11-01
2
158 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
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 500 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

9 Experts available now in Live!

Get 1:1 Help Now