Ver Mensaje Individual
  #7  
Antiguo 15-06-2004
Avatar de DarkByte
DarkByte DarkByte is offline
Miembro
 
Registrado: sep 2003
Ubicación: Desconocido
Posts: 1.322
Reputación: 22
DarkByte Va por buen camino
Saludos, encontré este hilo intentando responder a una duda mía. A mi me ha funcionado (a medias) así:
Código Delphi [-]
procedure Rastrear (Dir:string);
   var
      FileSearch:  TSearchRec;
   begin
     Screen.Cursor := crHourGlass;
     ChDir ( Dir );
     if FindFirst ( '*.*', faDirectory, FileSearch )=0 then
     repeat
     if ( (FileSearch.Attr and fadirectory) = fadirectory) then
       begin
         if  (FileSearch.Name <> '.')and (FileSearch.Name <> '..') then
           Rastrear( Dir + '\' + FileSearch.Name );
       end
     else
       begin
         {Pon aqui lo que quieras hacer con los ficheros encontrados}
         Form1.Memo1.Lines.Add (FileSearch.Name);
       end;
     until FindNext( FileSearch ) <> 0;
     FindClose( FileSearch );
     Screen.Cursor := crDefault;
  end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Rastrear ('C:\');
end;

Claro está, esto también me da los archivos de los subdirectorios y todo, cosa que no quiero. Me gustaría implantar la solución de Román a mi procedure, ya que el function de quimeras me da error en la primera línea como que no he definido el tipo de resultado (Uso Delphi Enterprise).

Muchas gracias
__________________
:)
Responder Con Cita