Autor Beitrag
JustusJonas
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 222



BeitragVerfasst: Di 25.01.05 15:48 
Nabend,

wie kann ich mir die älteste Datei in einem Verzeichnis anzeigen lassen?
Hab also ein Verzeichnis in dem sich mehrere Dateien befinden. Wie finde ich jetzt heraus welches die neueste ist?

Greetz
Benutzername
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 210

Win XP Pro
Delphi 7 PE, D2005 Prof. SSL
BeitragVerfasst: Di 25.01.05 15:56 
Schau dir mal Suche im MSDN GETFILETIME an ;-)
JustusJonas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 222



BeitragVerfasst: Do 27.01.05 16:53 
Danke schon mal für die Antwort!

Ich wollte das eigentlich mit FindFirt und FindNext lösen, hab aber keine Idee, wie ich das danach sortieren soll.

Greetz
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Do 27.01.05 17:00 
hallo justusjonas!

du könntest den record, den du mit FindFirst & FindNext erhältst in ein array einlesen und darin nach dem datumsfeld sortieren.

_________________
mfg, stefan
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 27.01.05 17:08 
oder man packt Objekte vom Typ TDatei mit den Eigenschaften Dateiname und Datum in eine TObjectlist und sortiert die Liste mit
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
Objectlist1.sort(Datum_sort);
[...]
function Datum_Sort(item1,item2:pointer):integer;
begin
    result:=compareDateTime(TDatei(item1).Datum,TDatei(item2).Datum)
end;

_________________
We are, we were and will not be.