Hallo, ich habe ein kleines Problem:
ich lasse mir mit folgender Funktion alle Dateien mit Größe und Attribut in einen string laden.
Allerdings ist das Attribut bei Dateien immer FILE_ATTRIBUTE_ARCHIVE, also habe ich da einfach 'Datei' hingeschrieben. Nun werden aber manche Ordner auch als Datei bezeichnet, weil sie archiviert werden können. Haben die Ordner noch ein zweites Attribut, welches besagt ob es ein Ordner oder eine Datei ist?
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:
| function getFull(path: string): string; var SR: TSearchRec; sAttr: string; begin FindFirst(path + '*.*', faAnyFile, SR); FindNext(SR);
repeat case SR.FindData.dwFileAttributes of FILE_ATTRIBUTE_ARCHIVE: sAttr := 'Datei'; FILE_ATTRIBUTE_COMPRESSED: sAttr := 'Datei [Komprimiert]'; FILE_ATTRIBUTE_DIRECTORY: sAttr := 'Ordner'; FILE_ATTRIBUTE_HIDDEN: sAttr := 'Datei [Versteckt]'; FILE_ATTRIBUTE_NORMAL: sAttr := 'Datei'; FILE_ATTRIBUTE_OFFLINE: sAttr := 'Datei [Offline]'; FILE_ATTRIBUTE_READONLY: sAttr := 'Datei [Schreibgeschützt]'; FILE_ATTRIBUTE_SYSTEM: sAttr := 'Systemdatei'; FILE_ATTRIBUTE_TEMPORARY: sAttr := 'Temporäre Datei'; end; Result := Result + SR.Name + '@@' + IntToStr(SR.Size) + '@@' + sAttr + sLineBreak; until FindNext(SR) <> 0;
SysUtils.FindClose(SR); end; |
Gruß,
Hendi