Autor Beitrag
D. Annies
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: So 29.11.09 08:54 
Hi, Delpher,

zu Beginn des Prg's wechsele ich von Lw F: auf Lw G:.
Warum wird eine DBTabelle, die ich in G: verändert habe, mit diesem Code nicht zurückgesichert?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
if fileexists(Pr_FileName) then    
          begin
            if ((FileDateToDateTime(FileAge(Pr_FileName)) <> FileDateToDateTime(FileAge(ExistingFilename))) and
               ((FileGetAttr(Pr_FileName) and faArchive) = faArchive)) then
            begin
              erg := xmessagedlg('ArchivBit wurde gesetzt' +#13 +
                       'Soll    ' + pr_filename+ ' '+#13+ datetimetostr(filedatetodatetime(FileAge(Pr_Filename))) +#13+
                       'durch '   + existingfilename  + ' '+#13+ datetimetostr(filedatetodatetime(FileAge(ExistingFileName))) +#13+
                       ' ersetzt werden?', mtConfirmation, [mbYes, mbno, mbcancel], ['ja''nein''Abbrechen'], self.font);

              case erg of mryes    : CopyFile(PChar(ExistingFileName), PChar(Pr_FileName), FALSE);
                          mrcancel : raus := true;
              end;
            end;
          end             {CreateDir oder forcedirectories(label30.caption+uvname);}
          else
          begin
            erg := xmessagedlg('Soll '+ pr_filename + #13' angelegt werden?', mtConfirmation,
                     [mbYes, mbNo, mbcancel], ['ja''nein''Abbrechen'], self.font);
            case erg of mryes    : begin                  //label30.caption+uvname
                                     if not directoryexists(ziel+uvname) then
                                       CreateDir(ziel+uvname);
                                     CopyFile(PChar(ExistingFileName), PChar(Pr_FileName), TRUE);
                                   end;
                        mrcancel : raus := true;
            end;
          end;


Die Meldung "Soll ... durch ... ersetzt werden?" wird angezeigt!

Danke für Hilfe,
Detlef

_________________
ut vires desint, tamen est laudanda voluntas
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mo 30.11.09 13:35 
Hi, Delpher,

bei 52 Hits sehe ich ja, dass ein grosses Interesse vorhanden ist.
Aber (noch) keine Antwort / Idee.

Fehlt euch zur Einschätzung noch mehr Code?
Was soll ich unternehmen?

Gruß, Detlef

_________________
ut vires desint, tamen est laudanda voluntas
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mo 30.11.09 14:05 
- Was steht in den Variablen drin?
- Verwendest du absolute Dateipfade?
- Hast du es schon mit Debuggen probiert, an welcher Stelle er hängen bleibt?

_________________
PROGRAMMER: A device for converting coffee into software.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mo 30.11.09 14:17 
CopyFile gibt meines Wissens einen Fehlercode zurück. Den fragst du nicht ab. Das solltest du aber. Das erleichtert die Fehlersuche.
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mo 30.11.09 17:42 
Danke, ihr zwei.
Ich prüfe das erstmal und melde mich (spätestens) dann wieder!
Gruß, Detlef

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

So, next Step:

ich habe jetzt folgende Überprüfung eingebaut:

ausblenden Delphi-Quelltext
1:
2:
3:
if (extractfileext(Pr_filename) = '.dbf'and (extractfileext(existingfilename) = '.dbf'then
              showmessage(Pr_filename + timetostr(FileDateToDateTime(FileAge(Pr_FileName))) + #13 +
                          existingfilename + timetostr(FileDateToDateTime(FileAge(existingfilename))));


und siehe da, obwohl ich einen Datensatz geändert habe, wird der Zeitstempel nicht geändert und Copyfile macht nichts.

Wie ändert man denn den Zeitstempel??

Gruß, Detlef

_________________
ut vires desint, tamen est laudanda voluntas
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mo 30.11.09 19:41 
Ich glaube das heißt FileSetDate.
Aber nagel mich nicht drauf fest. Habe gerade kein Delphi zur Hand.
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mo 30.11.09 22:32 
Hi, Peter,

sieht gut aus, deine Idee, bin heute bloß zu müde, es noch zu coden ...
Ich melde mich morgen wieder,
Detlef

_________________
ut vires desint, tamen est laudanda voluntas
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mi 02.12.09 20:16 
Hi,

leider alles ohne Erfolg, fileAge wird nicht geändert, auch nicht, wenn ich die DBTabelle schließe und wieder öffne. Was ich zu brauchen scheine, ist:
Wie kann ich FileAge verändern?

Gruß, Detlef

_________________
ut vires desint, tamen est laudanda voluntas
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mi 02.12.09 22:12 
Ändert sich denn die Anzeige im Explorer?

_________________
PROGRAMMER: A device for converting coffee into software.
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mi 02.12.09 22:23 
Hi, Xentar,

ja, die Anzeige im Explorer ändert sich tatsächlich!

Gruß, Detlef

_________________
ut vires desint, tamen est laudanda voluntas
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mi 02.12.09 22:44 
Kann sein, dass FileAge das Erstellungsdatum zurückgibt..
also hab ich mal "datei änderung datum" in die suche eingetippt, und das hier gefunden
www.delphi-forum.de/...ic.php?p=31802#31802

_________________
PROGRAMMER: A device for converting coffee into software.
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mi 02.12.09 22:57 
Hi, Xentar,

War ich jetzt zu hastig beim Lesen oder suche ich jetzt noch ein SetDateiDatum() ?

Erstmal Danke - Detlef

_________________
ut vires desint, tamen est laudanda voluntas