Показать сообщение отдельно
  #2  
Старый 20.03.2013, 18:49
melserega melserega вне форума
Прохожий
 
Регистрация: 20.03.2013
Сообщения: 5
Версия Delphi: Delphi 7
Репутация: 10
По умолчанию

Код:
unit Unit1;
interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, ComCtrls;

type
  TForm1 = class(TForm)
    SG: TStringGrid;
    Button1: TButton;
    MonthCalendar1: TMonthCalendar;
    SG1: TStringGrid;
    SG2: TStringGrid;
    SG3: TStringGrid;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  FindRes:Integer;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var FindFile: TSearchRec;
FindRes:Integer;

begin

FindRes:=FindFirst('\\Test\ARX_2013\__TAX__\ALL\\*.*',faAnyFile,FindFile); //Параметры функции задают поиск на диске с: любых файлов
      While FindRes=0 do
   begin
      if ((FindFile.Attr and faDirectory)=faDirectory) and
      ((FindFile.Name='.')or(FindFile.Name='..')) then
         begin
            FindRes:=FindNext(FindFile);
            Continue;
         end;
      if FileDateToDateTime(FindFile.Time)< MonthCalendar1.Date then
         begin
            FindRes:=FindNext(FindFile);
            Continue;
         end;

     begin
         SG.Cells[1, 0]:='     Имя файла'; //Инициация заголовка таблицы
         SG.Cells[2, 0]:='     Размер файла'; //Инициация заголовка таблицы
         SG.Cells[3, 0]:='     Дата файла'; //Инициация заголовка таблицы
         SG.Cells[0, 1]:='   1.ALL'; //Найден первый файл
         SG.Cells[1, 1]:=FindFile.Name; //Записываем в таблицу имя найденного файла
         SG.Cells[2, 1]:=IntToStr(FindFile.Size); //Записываем в таблицу размер найденного файла
         SG.Cells[3, 1]:=IntToStr(FindFile.Time);
         SG.Visible:=True;   //Если первый файл найден, показываем таблицу
         if (FindFile.Attr and faDirectory)=FindFile.Attr  //Определяем, это каталог или нет
           then SG.Cells[1, 1]:=SG.Cells[1, 1]+' '; //Если найденный файл - каталог, помечаем его
while FindNext(FindFile)=0 do //Ищем другие файлы на диске, пока не произойдёт ошибка поиска
  begin
      SG.RowCount:=SG.RowCount+1;
    SG.Cells[0, SG.RowCount-1]:='   '+IntToStr(SG.RowCount-1)+'.ALL';
    SG.Cells[1, SG.RowCount-1]:=FindFile.Name;
    SG.Cells[2, SG.RowCount-1]:=IntToStr(FindFile.Size);
    SG.Cells[3, SG.RowCount-1]:=IntToStr(FindFile.Time);
    if (FindFile.Attr and faDirectory)=FindFile.Attr
      then SG.Cells[1, SG.RowCount-1]:=SG.Cells[1, SG.RowCount-1]+' ';
  end;
  end;


  FindRes:=FindFirst('\\Test\ARX_2013\__TAX__\FIZ\\*.*',faAnyFile,FindFile); //Параметры функции задают поиск на диске с: любых файлов
      While FindRes=0 do
   begin
      if ((FindFile.Attr and faDirectory)=faDirectory) and
      ((FindFile.Name='.')or(FindFile.Name='..')) then
         begin
            FindRes:=FindNext(FindFile);
            Continue;
         end;
      end;
 end;
 FindRes:=FindNext(FindFile);
 end;
 FindClose(FindFile);
 end;

 end.
Админ: Пользуемся тегами для оформления кода!
Ответить с цитированием