Solved

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

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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 The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

737 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