So in Thread102-1193165 everyone helped me with some code to do a recursive file search and now I'm re-using that code and it's not working correctly.
I have the following directory structure:
[tt]
CaseDocs
00
CR
0338400 (documents in these folders)
0408400
0434300
0524800
0565800
0589600
[/tt]
I am using the following code to go through all the directories and copy the documents in the folders to a specific location. However, I am only getting the documents from every OTHER folder. I got the documents from the bolded folders above. What am I missing that it's skipping a folder?
Thanks!
Leslie
Leslie
In an open world there's no need for windows and gates
I have the following directory structure:
[tt]
CaseDocs
00
CR
0338400 (documents in these folders)
0408400
0434300
0524800
0565800
0589600
[/tt]
I am using the following code to go through all the directories and copy the documents in the folders to a specific location. However, I am only getting the documents from every OTHER folder. I got the documents from the bolded folders above. What am I missing that it's skipping a folder?
Thanks!
Leslie
Code:
procedure TForm1.Button2Click(Sender: TObject);
begin
SweepDir('\\srvcasedocs\CaseDocs\00\CR\');
end;
procedure TForm1.SweepDir(Dir : AnsiString);
var
SR : TSearchRec;
begin
if FindFirst(Dir + '*.*', faAnyFile, SR) = 0 then
begin
repeat
if (SR.Name <> '.') and (SR.Name <> '..') then
if SR.Attr = faDirectory then
begin
SweepDir(Dir + SR.Name + '\');
end
else
begin
CopyFileTo(Dir + SR.Name, '\\srvimaging\imaging\Citation\citationimages\_Consol Test\' + SR.Name)
end;
FindNext(SR);
until FindNext(SR) <> 0; //or FClosed;
FindClose(SR);
end;
end;
Leslie
In an open world there's no need for windows and gates