Daftar Semua File Dalam Direktory


Tips & Trik Delphi, Tips Belajar Delphi, Belajar Delphi Online
unit Unit1;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;

type
TForm1 = class(TForm)
btn1: TButton;
lst1: TListBox;
procedure btn1Click(Sender: TObject);
private

{ Private declarations }
public
{ Public declarations }
end;

var

Form1: TForm1;

implementation


{$R *.DFM}

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;

procedure TForm1.btn1Click(Sender: TObject);
begin
ListFileDir(‘C:\WINDOWS\’, Lst1.Items);
end;

end.

TransCODE Software

Satu pemikiran pada “Daftar Semua File Dalam Direktory

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s