Der folgende Code findet auf meinen Platten nicht alle Dateien.
Auf meiner "G"-Festplatte findet er alles einwandfrei, aber z.B. auf meiner "F"-Festplatte fidet er nichts.
Delphi-Quellcode:
procedure TForm1.ReadDir(path : string; sl : TStrings);
var
Fsr : TSearchRec;
FFileAttrs: Integer;
FName : string;
begin
path := IncludeTrailingPathDelimiter(path);
FFileAttrs := faAnyFile;
if FindFirst(Path + '*.*', FFileAttrs, Fsr) = 0 then
begin
repeat
if (fsr.Attr and faDirectory) = fsr.Attr then
begin
if copy(fsr.name,1,1) <> '.' then
ReadDir(Path+fsr.name, sl);
end
else if (fsr.Attr and FFileAttrs) = fsr.Attr then
begin
if copy(fsr.Name,1,1) <> '.' then begin
FName := path+fsr.Name;
sl.add(FName);
end;
end;
until FindNext(fsr) <> 0;
FindClose(fsr);
end;
end;
Beim Debuggen der Funktion ist mir aufgefallen das FindFirst für fsr.Attr = 8208 zurückliefert.
Kann das mal jemand überprüfen ?
PS :
Win XP-Pro SP2
Delphi 2005 [eng] Architect Trail
[edit=sakura] D2005 aus dem Titel entfernt. Mfg, sakura[/edit]