Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get list folder name in specified folder

Status
Not open for further replies.

PlutoDev

Programmer
Sep 21, 2002
25
ID
How to store list folder name in specified folder into TStringList

c:\mydocument\folder a
c:\mydocument\folder b
c:\mydocument\folder c
c:\mydocument\folder d

??function??('c:\mydocument\') return :
StrList := TStringList
StrList[0] = 'c:\mydocument\folder a'
StrList[1] = 'c:\mydocument\folder b'
StrList[2] = 'c:\mydocument\folder c'
StrList[3 = 'c:\mydocument\folder d'


how to get this ????

thanks
 
Code:
StrList := TStringList.Create;
StrList.Add('c:\mydocument\folder a');
StrList.Add('c:\mydocument\folder b');
StrList.Add('c:\mydocument\folder c');
StrList.Add('c:\mydocument\folder d');
 
DjangMan,
I think the OP wants to be able to put into a TStringList all the subfolders of a specific folder.

SOmething like this maybe:

Code:
var
sr : TSearchRecord
StrList : TSTringList;
begin
  StrList := TstringList.Create;
  if FindFirst('C:\MyDOcument\', faDirectory, sr) = 0 then
  begin
    repeat
      StrList.Add(sr.Name);
    until FindNext(sr) <> 0;
  end;
end;

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top