procedure findall(disk,path: String; var fileresult: Tstrings); <br>var <br>fpath: String; <br>fs: TsearchRec; <br>begin <br>fpath:=disk+path+'/*.*'; <br>if findfirst(fpath,faAnyFile,fs)=0 then <br>begin <br>if (fs.Name<>'.')and(fs.Name<>'..') then <br>if (fs.Attr and faDirectory)=faDirectory then <br>findall(disk,path+'/'+fs.Name,fileresult) <br>else <br>fileresult.add(disk+strpas(strupper(pchar(path)))+'/'+strpas( <br>strupper(pchar(fs.Name)))+'('+inttostr(fs.Size)+')'); <br>while findnext(fs)=0 do <br>begin <br>if (fs.Name<>'.')and(fs.Name<>'..') then <br>if (fs.Attr and faDirectory)=faDirectory then <br>findall(disk,path+'/'+fs.Name,fileresult) <br>else <br>fileresult.add(disk+strpas(strupper(pchar(path)))+'/'+str <br>pas(strupper(pchar(fs.Name)))+'('+inttostr(fs.Size)+')'); <br>end; <br>end; <br>findclose(fs); <br>end; <br><br>procedure DoSearchFile(Path: string; Files: TStrings = nil);<br>var<br> Info: TSearchRec;<br><br> procedure ProcessAFile(FileName: string);<br> begin<br> if Assigned(PnlPanel) then<br> PnlPanel.Caption := FileName;<br> Label2.Caption := FileName;<br> end;<br><br> function IsDir: Boolean;<br> begin<br> with Info do<br> Result := (Name <> '.') and (Name <> '..') and ((attr and fadirectory) = fadirectory);<br> end;<br><br> function IsFile: Boolean;<br> begin<br> Result := not ((Info.Attr and faDirectory) = faDirectory);<br> end;<br><br>begin<br> Path := IncludeTrailingBackslash(Path);<br> try<br> if FindFirst(Path + '*.*', faAnyFile, Info) = 0 then<br> if IsFile then<br> ProcessAFile(Path + Info.Name)<br> else if IsDir then DoSearchFile(Path + Info.Name);<br> while FindNext(Info) = 0 do<br> begin<br> if IsDir then<br> DoSearchFile(Path + Info.Name)<br> else if IsFile then<br> ProcessAFile(Path + Info.Name);<br> Application.ProcessMessages;<br> if QuitFlag then Break;<br> Sleep(100);<br> end;<br> finally<br> FindClose(Info);<br> end;<br>end;