?
Solved

Directories routine

Posted on 2003-02-28
2
Medium Priority
?
148 Views
Last Modified: 2010-04-04
Hello
Well, i need something like this:
   Theres a TCheckListBox in the Form, with many directories. Like:
      c:\meus documentos
      \\server\sys\docs
      c:\etc\etc\etc
   And one Memo with some directories. One in eatch line.
   Now i need to list in a ListBox all the directoris and subdirectories (recurive). I just dont want to list the directories written in the Memo. But in the fastest way. Can someone do it for me ? i am having big problems with other things and wont have time to do. Thank you.
0
Comment
Question by:BrunoMS
  • 2
2 Comments
 
LVL 3

Expert Comment

by:ILE
ID: 8045615
i answer the simular question yestersday
0
 
LVL 3

Accepted Solution

by:
ILE earned 580 total points
ID: 8045652
this is working solution if i andestand what u wont



procedure TForm1.BitBtn1Click(Sender: TObject);
var s:string;
    i,j:integer;
    fl:boolean;
begin
 listbox1.items.clear;
 for i:=0 to checklistbox1.count-1 do
begin
  s:=checklistbox1.items[i]; fl:=false;
  for j:=0 to memo1.lines.count-1;
   fl:= s=memo1.lines[j] or fl
 if fl then  getalldir(s);
end;
end;


procedure tform1.getalldir(s:string);
var rec :tsearchrec;
begin
if sysutils.findfirst(s + '*.*', faAnyFile, Rec)=0 then
begin
  repeat
    if (rec.name<>'.') and (rec.name<>'..') then
    begin
     listbox1.items.Add(s+Rec.Name);
     if rec.attr=fadirectory then getalldir(s+rec.name+'\');
    end;
  until SysUtils.FindNext(Rec) <> 0;
 sysutils.FindClose(rec);
end;


simular question in  
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Suggested Courses
Course of the Month9 days, 4 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question