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
| Var
sr: TSearchRec;
fileattrs, i, j: integer;
dt: tdatetime;
extension: String;
TabExtensionFiles: Array Of String[4];
Procedure SetArray(bChecked: boolean; sExt: String);
Var
iSize: integer;
Begin
If bChecked Then
Begin
iSize := Length(TabExtensionFiles) + 1;
SetLength(TabExtensionFiles, iSize);
TabExtensionFiles[iSize - 1] := AnsiLowerCase(sExt);
End;
End;
Function ArrayIndexOF(sText: String): integer;
Var
iPos: integer;
Begin
sText := AnsiLowerCase(ExtractFileExt(sText));
Result := -1;
For iPos := Low(TabExtensionFiles) To High(TabExtensionFiles) Do
Begin
If sText = TabExtensionFiles[iPos] Then
Begin
Result := iPos;
Break;
End;
End;
End;
Begin
SetLength(TabExtensionFiles, 0);
SetArray(ChBxLog.Checked, '.log');
SetArray(ChBxTMP.Checked, '.tmp');
SetArray(ChBxBAK.Checked, '.bak');
If EdtScan.Text = ' ' Then
MessageDlg('Aucun type de fichier na été sélectionner', mtError, [mbOK], 0)
Else
Begin
fileattrs := $0000003F;
j := 1;
With FResultatInventaire.StringGridResultatInventaire Do
Begin
RowCount := 0;
If FindFirst(FInventaire.EdtScan.Text + '\*', fileattrs, sr) = 0 Then
Repeat
If ((sr.Attr And fileattrs) = sr.Attr) And (ArrayIndexOF(sr.Name) <> -1) Then
Begin
RowCount := RowCount + 1;
Cells[0, RowCount - 1] := sr.Name;
Cells[1, RowCount - 1] := IntToStr(sr.Size);
dt := FileDateToDateTime(sr.time);
Cells[2, RowCount - 1] := datetimetostr(dt);
End;
Until FindNext(sr) <> 0;
FindClose(sr);
End;
End; |
Partager