![]() |
Details abfragen mit Indy
Hallo,
ich möchte mittels der Indykomponenten das Datum von einer Datei auf einem Server abfragen und diese gegebenenfalls runteladen. Das Runterladen funktioniert soweit, aber die Datumsabfrage bekomme ich nicht hin.
Delphi-Quellcode:
liefert mir ja die Details zur Datei Text.txt, gibt es eine Möglichkeit nur das Datum der Datei zu bekommen? Oder muß ich die Details "auseinanderpflücken"? :gruebel:
idFtp1.List(myList,'Text.txt',true)
Vielen Dank für Eure Hilfe :) Gruß Nele |
Re: Details abfragen mit Indy
Hier ist aber nicht von mir:
Delphi-Quellcode:
Mfg MrScholz
function GetFileDate(const FileName: string; out Creation, LastAccess,
LastWrite: TDateTime): Boolean; var hFile: THandle; ftCreationUTC, ftLastAccessUTC, ftLastWriteUTC: TFileTime; ftCreationLocal, ftLastAccessLocal, ftLastWriteLocal: TFileTime; stCreationLocal, stLastAccessLocal, stLastWriteLocal: TSystemTime; begin result:=false; hFile := CreateFile(PChar(FileName), GENERIC_READ, 0, nil, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); if (hFile <> INVALID_HANDLE_VALUE) then begin try //Ermittlung des Dateidatums in UTC (Weltzeit) if GetFileTime(hFile, @ftCreationUTC, @ftLastAccessUTC, @ftLastWriteUTC) then begin //Umrechnung in Ortszeit if FileTimeToLocalFileTime(ftCreationUTC, ftCreationLocal) and FileTimeToLocalFileTime(ftLastAccessUTC, ftLastAccessLocal) and FileTimeToLocalFileTime(ftLastWriteUTC, ftLastWriteLocal) then begin //Umwandlung in Systemdatumformat if FileTimeToSystemTime(ftCreationLocal, stCreationLocal) and FileTimeToSystemTime(ftLastAccessLocal, stLastAccessLocal) and FileTimeToSystemTime(ftLastWriteLocal, stLastWriteLocal) then begin //Zuweisung der Rückgabewerte Creation := SystemTimeToDateTime(stCreationLocal); LastAccess := SystemTimeToDateTime(stLastAccessLocal); LastWrite := SystemTimeToDateTime(stLastWriteLocal); result:=true; end; end; end; finally CloseHandle(hFile); end; end; end; procedure TForm1.Button1Click(Sender: TObject); var erstellung, zugriff, schreibzugriff: TDateTime; begin GetFileDate('c:\temp\test.bmp', erzeugung, zugriff, schreibzugriff); ShowMessage('Erstellung: '+DateTimeToStr(erstellung)+#13#10+'Letzter Zugriff: '+ DateTimeToStr(zugriff)+#13#10+'Letzter Schreibzugriff: '+DateTimeToStr(schreibzugriff)); end; |
Re: Details abfragen mit Indy
Nicht von dir und am Thema vorbei. Mit deinem Code bekommst du nur das datum auf einem lokalen Windows Rechner aber nicht einer datei auf einem FTP Server im Netz. Nicht umsonst steht die Frage in der "Internet / IP / Lan" Sparte. ;)
|
Re: Details abfragen mit Indy
Ich hatte eigendlich gedacht, dass es bei den Indy-Komponenten etwas ähnliches wie bei der TNMFTP-Komponente gibt....
Delphi-Quellcode:
das war so schön einfach :roll:
datum:= TNMftp1.FTPDirectoryList.ModifDate[i];
Gruß Nele |
Re: Details abfragen mit Indy
Zitat:
man könte das ja umprogrammieren und wenn nicht sry und :oops: oder :wall:. Mfg MrScholz |
Re: Details abfragen mit Indy
Hi,
wie wärs mit
Delphi-Quellcode:
Gruss lkz633
IdFTP1.DirectoryListing.Items[x].ModifiedDate
|
Re: Details abfragen mit Indy
So etwas suche ich ja...
Delphi-Quellcode:
...aber das kommt dabei raus :shock:
IdFTP1.DirectoryListing.Items[0].ModifiedDate;
Zitat:
Gruß Nele |
Re: Details abfragen mit Indy
Setz doch einfach mal den Punkt und warte ab, was dir die Codevervollständigung zur Auswahl anbietet. :roll:
|
Re: Details abfragen mit Indy
Wenn mir 'DirectoryListing' angeboten würde, hätte ich wahrscheinlich diese Frage nicht gestellt 8)
[...ganz sicher bin ich mir dessen aber nicht :lol: ] Wenn ich mir mein Delphi anschaue gibt es 'DirectoryListing' für die Indy-Komponente nicht, aber wer weiß schon, was mein Rechner/Delphi wieder gegen mich hat, dass er/es mir diese Eigenschaft verschweigt :roll: Gruß Nele, die jetzt verzweifelt versucht der Indy-Komponente mehr Eigenschaften zu entlocken |
Re: Details abfragen mit Indy
Zitat:
|
Re: Details abfragen mit Indy
Clevere Mädchen auch :wink:
Hab da nix gefunden, daher meine Frage... Gruß Nele |
Re: Details abfragen mit Indy
Container for a structured file and directory listing.
property DirectoryListing: TIdFTPListItems; Description DirectoryListing is a read-only TIdFTPList property that represents the container and parser for TIdFTPListItem instances created from the result values for the List or Status methods. DirectoryListing is always cleared prior to adding the values returned by List or Status. DirectoryListing provides a structured means of accessing data about files and directories returned from the FTP LIST, NLST, or STAT commands. DirectoryListing can also be used to populate GUI controls that display the results of the FTP operation, like TTreeView. DirectoryListing can be used with the OnParseCustomListFormat event handler to allow parsing of FTP List formats not normally supported by TIdFTPList. DirectoryListing is initialized prior to use in List, or using the OnCreateFTPList event handler. DirectoryListing is freed in the Destroy method. |
Re: Details abfragen mit Indy
Verwendest du evtl. die mitgelieferten Indy-Komponenten? Bei
![]() |
Re: Details abfragen mit Indy
Ok, dann sollte ich wohl mal meine Indy-Komponenten kontrollieren, wer weiß, wie alt die schon sind ;-)
Danke Gruß Nele [edit1] @scp - Ehrlich gesagt - keine Ahnung - hab sie bis heute noch nie benutzt :oops: [edit2] - so, nachgesehen Version 8.0.25 - neu ist das wohl nicht, oder ;-) |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:11 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz