找到目录下的文件夹 并且进行压缩,然后再生成压缩文件到指定目录

本文介绍如何在操作系统中查找特定目录下的所有文件夹,使用压缩工具进行压缩,并将生成的压缩文件移动到指定的目标目录。这对于数据管理和备份操作非常有用。
摘要由CSDN通过智能技术生成
unit uMainForm;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ioutils, Types, zip, Vcl.StdCtrls,
  Vcl.ExtCtrls;

type
  TForm2 = class(TForm)
    LabeledEdit1: TLabeledEdit;
    LabeledEdit2: TLabeledEdit;
    LabeledEdit3: TLabeledEdit;
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
var
  dfs : TStringDynArray;
  strDirectory : string;
  strFile : string;
begin
  dfs := TDirectory.GetDirectories(self.LabeledEdit1.Text, self.LabeledEdit2.Text);
  for strDirectory in dfs do
  begin
    strFile := (TPath.GetFileName(strDirectory));

    TZipFile.ZipDirectoryContents(self.LabeledEdit3.Text 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值