Ver Mensaje Individual
  #2  
Antiguo 29-12-2003
Descendents Descendents is offline
Miembro
 
Registrado: may 2003
Ubicación: Barcelona
Posts: 396
Reputación: 22
Descendents Va por buen camino
Código:
 procedure TForm1.BuscaFicheros(path, mask : AnsiString; var Value : TStringList; brec : Boolean);
 var
   srRes : TSearchRec;
   iFound : Integer;
 begin
   if ( brec ) then
     begin
     if path[Length(path)] <> '\' then path := path +'\';
     iFound := FindFirst( path + '*.*', faAnyfile, srRes );
     while iFound = 0 do
       begin
       if ( srRes.Name <> '.' ) and ( srRes.Name <> '..' ) then
         if srRes.Attr and faDirectory > 0 then
           BuscaFicheros( path + srRes.Name, mask, Value, brec );
       iFound := FindNext(srRes);
       end;
     FindClose(srRes);
     end;
   if path[Length(path)] <> '\' then path := path +'\';
   iFound := FindFirst(path+mask, faAnyFile-faDirectory, srRes);
   while iFound = 0 do
     begin
     if ( srRes.Name <> '.' ) and ( srRes.Name <> '..' ) and ( srRes.Name <> '' ) then
       Value.Add(path+srRes.Name);
     iFound := FindNext(srRes);
     end;
   FindClose( srRes );
 end;

lo llamas asi

Código:
 procedure TForm1.Button1Click(Sender: TObject);
 var
    Ficheros:TStringList;
 begin
   Ficheros:=TStringList.Create;
   BuscaFicheros('c:\delphi3\','*.*',Ficheros,TRUE);
   Memo1.Lines.Assign(Ficheros);
   Ficheros.Free;
 end;
Esta sacado del trucomania

Con este procedimiento los localizas, y los eliminas o lo que quieras

Saludos
Responder Con Cita