1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Edit1: TEdit; Button1: TButton; Schreibschutz: TListBox; Edit2: TEdit; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private public end;
var Form1: TForm1; schs,i : integer;
implementation
{$R *.dfm}
procedure GetFilesInDirectory(ADirectory: string; AMask: String; AList: TStrings; ARekursiv: Boolean); var SR2: TSearchRec; begin if (ADirectory<>'') and (ADirectory[length(ADirectory)]<>'\') then ADirectory:=ADirectory+'\';
if (FindFirst(ADirectory+AMask,faAnyFile-faDirectory,SR2)=0) then begin repeat if (SR2.Name<>'.') and (SR2.Name<>'..') and (SR2.Attr<>faDirectory) then AList.Add(ADirectory+SR2.Name) until FindNext(SR2)<>0; Sysutils.FindClose(SR2); end;
if ARekursiv then if (FindFirst(ADirectory+'*.*',faDirectory,SR2)=0) then begin repeat if (SR2.Name<>'.') and (SR2.Name<>'..') then GetFilesInDirectory(ADirectory+SR2.Name,AMask,AList,True); until FindNext(SR2)<>0; Sysutils.FindClose(SR2); end; end; procedure TForm1.Button1Click(Sender: TObject); begin GetFilesInDirectory(Edit1.Text,'*.*',Schreibschutz.Items,True); for schs:=0 to ((Schreibschutz.Count)-1) do begin Edit2.Text := Edit2.Text + ',' + InttoStr(FileSetAttr(Schreibschutz.Items.Strings[i],0)); end; end;
end. |