En  Fa
softprojects.org
Discovering: Tips & Tricks  > Languages  > Delphi Tips  > Get list of files in a directory
 

Articles

 

 

Tips and Tricks

 


 

Get list of files in a directory

Print version  

Get list of files in a directory

Description

A method that returns list of all files in specified directory.

Delphi code

procedure ListFileDir(Path: string; FileList: TStrings);
var
    SR: TSearchRec;
begin
    if FindFirst(Path + '*.*', faAnyFile, SR) = 0 then
    begin
        repeat
            if (SR.Attr <> faDirectory) then
            begin
                FileList.Add(SR.Name);
            end;
        until FindNext(SR) <> 0;
        FindClose(SR);
    end;
end;

Details
      
Writer: Salar Khalilzadeh
Date Sent: 3/16/2008 7:25 AM
Views: 294
Votes: 0
Rating: Not Rated from Not Rated

Your Rating:
bookmark this
 

There is no comment for this topic.

Language:

Copyright © 2008 SoftProjects.org | About | Valid XHTML | CSS