Autor Beitrag
T.E.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 31

Win RT, Win 7 Pro, Win 8 Pro
Delphi 2009 Enterprise, Delphi XE, Delphi XE2
BeitragVerfasst: Di 21.09.10 16:32 
Moin moin,

ich speichere mir die Dateilisten von zwei Servern in eine Stringlist und gebe den Inhalt dann formatiert wieder aus. Problem ist nun aber, dass das Änderungsdatum anschließend nicht mehr stimmt, dann sollen nämlich alle Dateien vom 30.12.1899 00:00:00 sein.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
[...]
FTPSrv.list(filelist,'*.mxf',True);
for i := 0 to FTPSrv.DirectoryListing.Count - 1 do
  with FTPSrv.DirectoryListing.Items[i] do
    FileListBox.AddItem(formatdatetime('dd.mm.yyyy hh:nn:ss', modifiedDate) + ' - ' + Filename, filelist);
[...]


Kann mir jemand sagen woran das liegt? Weil wenn ich das Verzeichnis normal mit List abrufe ist das Datum korrekt.

_________________
Schöne Grüße,
Torben
Georg08
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 155
Erhaltene Danke: 6

Win XP
Delphi 7.0 Personal
BeitragVerfasst: Di 21.09.10 18:16 
[Wo weißt du modifiedDate denn einen Wert zu?]
Sorry habe with ... do übersehen. Ich nehme mal an, dass Items[I] die Option modifiedDate hat :oops:


Zuletzt bearbeitet von Georg08 am Di 21.09.10 19:04, insgesamt 2-mal bearbeitet
T.E. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 31

Win RT, Win 7 Pro, Win 8 Pro
Delphi 2009 Enterprise, Delphi XE, Delphi XE2
BeitragVerfasst: Di 21.09.10 18:55 
Ich wollte gerade fragen, ob das nicht durch FTPSrv.DirectoryListing bereits mit geladen wird und dann nur noch entsprechend formatiert werden muss...
:)

_________________
Schöne Grüße,
Torben
Georg08
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 155
Erhaltene Danke: 6

Win XP
Delphi 7.0 Personal
BeitragVerfasst: Di 21.09.10 19:04 
Ich weiß zwar nicht woher es kommt, aber ch glaub dir jetzt einfachmal, dass es gesetzt ist...
Gib es doch mal Testweise in ein Label auf oder ein ShowMessage()
T.E. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 31

Win RT, Win 7 Pro, Win 8 Pro
Delphi 2009 Enterprise, Delphi XE, Delphi XE2
BeitragVerfasst: Mi 22.09.10 07:54 
ich habe jetzt einfach mal direkt das Datum und die Uhrzeit in einem ShowMessage anzeigen lasse und erhalte das gleiche Datum:

ausblenden Delphi-Quelltext
1:
ShowMessage(DateTimeToStr(FTPSrv.DirectoryListing.Items[i].ModifiedDate));					


PS: Angenommen ich weise ModifiedDate wirklich nichts zu - weil ich hab es nirgendwo deklariert - dann müsste der Compiler doch schon eigtl meckern... oder?

Edit: Ich habe auch die IdAllFTPListParsers in der Uses drin... :S

Edit 2: ich habe das Problem nun gelöst. Allerdings etwas anders:
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:
var 
  i: integer;
  s_filename, s_modifieddate, s_size: string;
  L: TIdFTPListItems; //Setzt voraus das IdFTPList in uses eingebunnden ist
begin
  Filelistbox.Clear;
  
  filelist := TStringlist.Create;
 
  try
    FTPSrv.List(filelist,'*.mxf',True);
    L := FTPSrv.DirectoryListing;
  finally
    for i := 0 to L.Count - 1 do
      with L.Items[i] do
      begin
        s_filename := FileName;
        s_modifieddate := DatetoStr(ModifiedDate);
        s_size := IntToStr(Size);
        Filelistbox.AddItem(s_modifieddate + ' ' + s_filename + ' ' + s_size, L);
      end;
  end;
end;

_________________
Schöne Grüße,
Torben