Autor Beitrag
110022
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 287

XP SP2
Delphi 7
BeitragVerfasst: So 24.02.08 14:56 
Ich habe: edit1, button1
und einen Ordner mit dateien.

wenn ich auf den Button klicke sollen die Dateien aus dem ordner
in ein Verzeichnis kopiert werden , dass ich vorher ins editfeld getippt habe.
(C:\Hallo\Huhu\)

wie geht das?

wie is der qt davon?


110022


Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am So 24.02.2008 um 14:59
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: So 24.02.08 15:00 
Wie wärs damit:
ausblenden Delphi-Quelltext
1:
ShellExecute(0,'open','http://gidf.de/delphi+datei+kopieren',nil,nil,SW_ShowNormal);					

(ShellApi in die Uses)

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
blackdevile
Hält's aus hier
Beiträge: 8



BeitragVerfasst: So 24.02.08 19:09 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
function Kopieren(const Quell, Ziel: string;
   Check: boolean = false): boolean;
var
  sh: TSHFileOpStruct;
begin
  sh.Wnd := Application.Handle;
  sh.wFunc := fo_Copy;

  // String muss mit #0#0 Terminiert werden, um das Listenende zu setzen
  sh.pFrom := PChar(Quell + #0);
  sh.pTo := PChar(Ziel + #0);
  sh.fFlags := fof_Silent or fof_MultiDestFiles or fof_NOCONFIRMATION;
  if Check then
    sh.fFlags := sh.fFlags or fof_RenameOnCollision;
  Result:=ShFileOperation(sh)=0;
end;


Is ne Funktion bei mir im Program funktioniert einwandfrei, du rufst sie auf mit: Kopieren("von wo","nach wo");
von wo und nach wo sollte offensichtlich sein durch was du ersetzen musst.

greetz
chris
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Mo 25.02.08 13:57 
ausblenden Delphi-Quelltext
1:
CopyFile(Source, Dest, FailIfExists);					

Source: Quelldatei
Dest: Zieldatei
FailIfExists: Abbrechen, wenn Zieldatei schon existiert?

Diese Funktion unterbricht das Programm, bis die Datei kopiert ist. Das ist aber bei kleinen Dateien egal. Ein Explorer-Dialog wird nicht angezeigt, alles läuft ganz leise.
110022 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 287

XP SP2
Delphi 7
BeitragVerfasst: So 02.03.08 19:58 
was muss ich denn einfügen , damit eine Frege gesstellt wird wenn die Dateien schon existieren?
und wie bekomme ich eine meldung wenn das kopieren beendet ist?


110022
bflegel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 193
Erhaltene Danke: 1

Win XP, Win 7, BS2000
D5
BeitragVerfasst: So 02.03.08 20:12 
Hallo,

frage doch über FileExists ab ob die Datei schon vorhanden ist.

bye
bflegel

_________________
I know all the jokes about my name
110022 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 287

XP SP2
Delphi 7
BeitragVerfasst: So 02.03.08 21:20 
und wie stehts mit der meldung nach dem kopieren?
Bethsoftfan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win XP, Linux OpenSuSE 10.3 mit Compiz Fusion :cool:
Delphi 2007 Prof. Delphi 5
BeitragVerfasst: Mo 03.03.08 17:41 
Hallo,

Du setzt variablen ein und machst das auch mit FileExists regeln :wink:
Unknown
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 184

Win XP
Delphi 7
BeitragVerfasst: Di 04.03.08 17:57 
Hallo,

Quelltext nicht getestet:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
if FileExists('C:/blabla/blub')
 then
  showmessage('diese Datei blub schon')
 else
  begin
   CopyFile('C:/blablabla/blub', 'C:/blabla/blub', false);
   showmessage('Fettig');
  end;