Arquivos em subdiretórios
Pessoal, estou precisando fazer o seguinte.. tenho um diretório que possui ´n´ diretórios dentro dele com arquivos ´.txt´ dentro, preciso fazer um programa onde eu informe apenas o 1º diretório, então o programa deverá garimpar todos os subdiretórios pra fazer pesquisas dentro dos arquivos que estiverem dentro de cada subdiretório, alguém sabe coma fazer isto?
Phenomenom
Curtidas 0
Respostas
Phenomenom
05/09/2003
E aí pessoal, será que ninguém sabe?
GOSTEI 0
Eneblis
05/09/2003
E aí pessoal, será que ninguém sabe?
Talvez isso ajude, fiz algo semelhante usando:
[i:04d88fb1b1][color=darkred:04d88fb1b1]var cont : integer;
ListArq : TStringList;
begin
ListArq := GetFileList(´C:\teste\*.txt´);
cont:= 0;
Gauge1.MaxValue := ListArq.Count;
Application.ProcessMessages;
while (cont <= ListArq.Count-1) do
begin
nome_arq := ListArq.Strings[cont];
AssignFile(arq,nome_arq);
{$I-}
Reset(arq);
{$I+}
if (IOResult = 0) then
begin
while not Eof(arq) do
begin
Readln(arq,linha);
Showmessage(Copy(linha,1,6));
end;{fim while}
CloseFile(arq);
MoveFile(PChar(nome_arq),PChar(´C:\temp\´+nome_arq));
end;{fim if}
cont := cont+1;
Gauge1.Progress := Gauge1.Progress + 1;
Application.ProcessMessages;
end;{fim while}[/color:04d88fb1b1][/i:04d88fb1b1]
end;
GOSTEI 0
Cebikyn
05/09/2003
Mais opções:
Pesquisar texto dentro de arquivos:
http://www.swissdelphicenter.ch/torry/showcode.php?id=277
http://www.swissdelphicenter.ch/torry/showcode.php?id=847
Pesquisar arquivos em subpastas
http://www.swissdelphicenter.ch/torry/showcode.php?id=154
Pesquisar texto dentro de arquivos:
http://www.swissdelphicenter.ch/torry/showcode.php?id=277
http://www.swissdelphicenter.ch/torry/showcode.php?id=847
Pesquisar arquivos em subpastas
http://www.swissdelphicenter.ch/torry/showcode.php?id=154
GOSTEI 0