⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit7.pas

📁 绝对一流的压缩解压程序
💻 PAS
字号:
unit Unit7;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons,filectrl,mmsystem;

type
  TForm7 = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    GroupBox2: TGroupBox;
    GroupBox3: TGroupBox;
    Memo1: TMemo;
    GroupBox4: TGroupBox;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    l2: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
  private
    { Private declarations }
  public
   procedure file_information(sourcepath:string);
  end;

var
  Form7: TForm7;
  filecount,dircount,filesize:longint;
  tj_dir:string;
implementation
 uses unit2;
{$R *.dfm}
procedure tform7.file_information(sourcepath:string);
var
 sr:tsearchrec;
begin
 sourcepath:=includetrailingbackslash(sourcepath);
      if findfirst(sourcepath+'\*.*',faanyfile,sr)=0 then
      begin
       repeat
       if(sr.Name<>'.')and(sr.Name<>'..')then
        begin
          if sr.Attr<>fadirectory then
           begin
            filecount:=filecount+1;
            filesize:=filesize+sr.Size;
            memo1.Lines.Add('文件***'+sourcepath+sr.Name+'***');
            edit2.Text:='文件数目:'+inttostr(filecount);
            edit3.Text:='文件大小:'+inttostr(trunc(filesize/(1024*1024)))+'MB';
             end else
               begin
                 memo1.Lines.Add('文件夹目录***'+sourcepath+sr.Name+'***');
                 dircount:=dircount+1;
                 file_information(sourcepath+sr.Name);
                 edit1.Text:='文件夹数目:'+inttostr(dircount);
                 end;
                 END;
                 until findnext(sr)<>0
                 end ;
                 findclose(sr);
end;
procedure TForm7.BitBtn1Click(Sender: TObject);
begin
playsound(pchar('down1'),hinstance,snd_async or snd_resource);
    if selectdirectory(tj_dir,[sdallowcreate,sdperformcreate,sdprompt],0) then
           l2.Caption:='您选择的文件夹目录为:'+tj_dir;
end;

procedure TForm7.BitBtn2Click(Sender: TObject);
begin
playsound(pchar('down1'),hinstance,snd_async or snd_resource);
 filecount:=0;
 dircount:=0;
 filesize:=0;
 memo1.Clear;
 edit1.Clear;
 edit2.Clear;
 edit3.Clear;
 if tj_dir<>'' then
 file_information(tj_dir) else
   messagedlg('请您选择好要统计的目录!',mtinformation,[mbok],0);
end;

procedure TForm7.BitBtn3Click(Sender: TObject);
begin
playsound(pchar('down1'),hinstance,snd_async or snd_resource);
    close;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -