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

Get list of files in a directory

   

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: 6/14/2008 7:25 AM
Views: 1300
Votes: 2
Rating:   from 2.50 Points

Your Rating:

bookmark this
 

There is no comment for this topic.
Language:

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