Autor Beitrag
MaRiO
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20

Windows XP
D7 Prof.
BeitragVerfasst: Sa 29.11.03 14:04 
Hallo @ All

Ich weiss das es mehrere Threads über das kopieren von Dateien gibt allerdings konnte Ich nichts passendes finden.

Ich möchte folgendes Machen :

Ich brauche eine Funktion oder Procedure die mir aus dem Ordner A alle Dateien Inclusiv Unterordner nach Ordner B kopiert.
Das habe Ich auch schonmal gemacht, aber die Funktion soll mir nach jedem Schreiben der Datei einen Eintrag in eine Listbox einfügen, ob die Datei Fehlerfrei kopiert worden ist.

Und sollten die Dateien schon im Zielordner stehen, soll die Procedure ohne Nachfrage die alten Dateien Überschreiben.

Kann mir dabei jemand Helfen ? :?:

Danke im Voraus.

Mfg
Mario

Hier mein Code für das Kopieren der Ordner, allerdings kommt bei diesem Code immer "Soll die Datei Überschrieben werden ?".


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
function CopyDir(const fromDir, toDir: string): Boolean; 
var 
  fos: TSHFileOpStruct;
begin 
  ZeroMemory(@fos, SizeOf(fos)); 
  with fos do 
  begin
    Application.ProcessMessages;
    wFunc  := FO_COPY; 
    fFlags := FOF_FILESONLY; 
    pFrom  := PChar(fromDir + #0); 
    pTo    := PChar(toDir)
  end;
  Result := (0 = ShFileOperation(fos)); 
end;

_________________
Application.MessageBox('Delphi ist Cool', 'Delphi 7', 1);
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Sa 29.11.03 14:44 
Hi!

Suche in: Delphi-Forum, Delphi-Library SHFILEOPERATION ist eine API Funktion. Wo sind diese online dokumentiert? In der msdn. Ok, dann geht's hier lang:
msdn.microsoft.com/l...s/shfileopstruct.asp
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Sa 29.11.03 14:48 
Hallo

ausblenden Delphi-Quelltext
1:
Flags := ... + FOF_NOCONFIRMATION					


//edit: zu langsam, man sollte sich während des Posten doch nix zu trinken holen ;)

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
MaRiO Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20

Windows XP
D7 Prof.
BeitragVerfasst: Sa 29.11.03 15:20 
Hallo Ihr beiden !

Vielen Dank für euere Tips :D

Habe folgende Sachen übernommen.
FOF_NOCONFIRMATION or FOF_NOCONFIRMMKDIR or FOF_SIMPLEPROGRESS;

Aber wie bekomme Ich es hin das er mir in mein Log Fenster Schreibt welche Datei er gerade Sichert, und ob das Sichern erfolgreich war ??

Mfg
Mario

_________________
Application.MessageBox('Delphi ist Cool', 'Delphi 7', 1);
MaRiO Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20

Windows XP
D7 Prof.
BeitragVerfasst: So 30.11.03 15:45 
Hallo !

Ich habe mir die Seite von Ms nochmal Angeschaut, bin aber immer noch nicht schlauer.

Kann Ich den wärend der Kopieraktion wirklich nicht Mitloggen ob die Datei Ordentlich rüber gekommen ist ?? :?:

MFg
Mario

_________________
Application.MessageBox('Delphi ist Cool', 'Delphi 7', 1);