Fórum Ler Conteudo de um pasta #8752
19/08/2009
0
Alexandro Oliveira
Curtir tópico
+ 0Posts
20/08/2009
Wesley Yamazack
Segue abaixo a imagem da tela para poder fazer o exemplo.
{ Criar esta procedure para poder listar os diretórios}
procedure TForm1.ListarArquivos(Diretorio: string; Sub:Boolean);
var
F: TSearchRec;
Ret: Integer;
TempNome: string;
begin
Ret := FindFirst(Diretorio+'\*.*', faAnyFile, F);
try
while Ret = 0 do
begin
if TemAtributo(F.Attr, faDirectory) then
begin
if (F.Name <> '.') And (F.Name <> '..') then
if Sub = True then
begin
TempNome := Diretorio+'\' + F.Name;
ListarArquivos(TempNome, True);
end;
end
else
begin
memLista.Lines.Add(Diretorio+'\'+F.Name);
end;
Ret := FindNext(F);
end;
finally
begin
FindClose(F);
end;
end;
end;
{Criar esta função para ver se os mesmos tem algum atributo}
function TForm1.TemAtributo(Attr, Val: Integer): Boolean;
begin
Result := Attr and Val = Val;
end;
{NO Clique do botão}
procedure TForm1.Button1Click(Sender: TObject);
begin
memLista.Lines.Clear;
ListarArquivos(edtDiretorio.Text, chkSub.Checked);
end;
Com isso, você consegue ter a lista de arquivos que estao dentro de um determinado diretorio
Seria isso ?
UM abraço
Wesley Y
Gostei + 0
25/08/2009
Wesley Yamazack
O exemplo ficou claro ? Consegui fazer o mesmo? Estamos a disposição para lhe ajudar, e fechar o chamado.
Att,
Wesley Y
Gostei + 0
29/08/2009
Alexandro Oliveira
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)