Podes usar esta função que fiz para devolver um TStringlist com a lista de ficheiros dentro de uma pasta
function ListFileDir(Path,Ext: string;OnlyTopFolder:boolean; var FileList: TStringList):boolean;
var
SR: TSearchRec;
begin
result:=false;
if DirectoryExists(path) then
Begin
result:=true;
if FindFirst(Path + '*'+Ext, faAnyFile, SR) = 0 then
begin
repeat
FileList.Add(Path+SR.Name);
until FindNext(SR) <> 0;
FindClose(SR);
end;
if not OnlyTopFolder then
if FindFirst(Path+'*' , faDirectory, SR) = 0 then
begin
repeat
if (SR.Name<>'..') and (SR.Name<>'.') then
ListFileDir(Path+SR.Name+'\',ext,OnlyTopFolder,FileList);
until FindNext(SR) <> 0;
FindClose(SR);
end;
end;
end;
Basicamente passas o caminho e extensão de ficheiros que queres e passas uma TStringList por referência.
Depois é uma questão de correres a TStringList a copiar os ficheiros e a mostrar numa TProgressBar
↧