找到目录下的文件夹 并且进行压缩,然后再生成压缩文件到指定目录
2017-11-28 16:24
441 查看
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 + '\' + strFile + '.zip', strDirectory); end; end; procedure TForm2.FormCreate(Sender: TObject); begin self.LabeledEdit1.Text := TPath.GetFullPath('.\'); self.LabeledEdit2.Text := '*'; self.LabeledEdit3.Text := TPath.GetFullPath('..\'); end; end.object Form2: TForm2Left = 0Top = 0Caption = #33258#21160#25171#21253#22120ClientHeight = 421ClientWidth = 691Color = clBtnFaceFont.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -11Font.Name = 'Tahoma'Font.Style = []OldCreateOrder = FalseOnCreate = FormCreatePixelsPerInch = 96TextHeight = 13object LabeledEdit1: TLabeledEditLeft = 40Top = 48Width = 561Height = 21EditLabel.Width = 60EditLabel.Height = 13EditLabel.Caption = #25991#20214#22841#36335#24452TabOrder = 0endobject LabeledEdit2: TLabeledEditLeft = 40Top = 96Width = 121Height = 21EditLabel.Width = 60EditLabel.Height = 13EditLabel.Caption = #25991#20214#22841#25513#30721TabOrder = 1endobject LabeledEdit3: TLabeledEditLeft = 40Top = 144Width = 561Height = 21EditLabel.Width = 48EditLabel.Height = 13EditLabel.Caption = #36755#20986#36335#24452TabOrder = 2endobject Button1: TButtonLeft = 40Top = 192Width = 121Height = 65Caption = #24320#22987'(&S)'TabOrder = 3OnClick = Button1Clickendend
相关文章推荐
- 获取文件夹下的文件名生成新的文件&DOC命令想从指定的txt中读出文件名,然后在指定文件夹以及子目录下搜索文件,并拷贝到指定目录
- VS IDE Release或Debug进行运行时,在Debug或Release文件夹中的文件或者库文件不能直接找到,需要加上Debug或Release目录
- Linux系统下创建任务,对指定目录文件进行自动压缩存档
- Jsoup学习笔记6之File类操作文件:获取指定目录下面,指定扩展名(.saz)的文件,并在对应的文件夹下生成同名的csv文件。
- 对指定文件或目录进行压缩和解压缩的工具类总结
- 使用ZLIB生成DLL文件,并进行有中文的ZIP文件压缩与解压操作!支持目录压与解!
- 预编译加速编译(precompiled_header),指定临时文件生成目录,使项目文件夹更干净(MOC_DIR,RCC_DIR, UI_DIR, OBJECTS_DIR),#pragma execution_character_set("UTF-8")"这个命令是在编译时产生作用的,而不是运行时
- Linux系统下创建任务,对指定目录文件进行自动压缩存档
- 根据提供的文件名文本,查找指定目录下的该文件,找到后复制到指定文件夹--bash
- hdfs中将文件夹下所有.bz2文件进行解压并且合并,然后传到本地
- java 把指定文件夹下的所有文件目录和文件都压缩到指定文件夹下
- 扫描一个目录下的所有文件,根据这些文件的创建日期生成一个文件夹,然后把这些文件移入这个文件夹下面
- 【spring boot logback】日志logback 生成日志文件在本项目下,而不在指定的日志文件目录下/指定日志文件到达最大值后不按照配置进行切割
- vb-复制ie临时文件夹下所有mp3文件到指定目录,并且将utf8编码转换过来
- 从本地目录读取指定.txt文件,并且对数据进行解析。
- vb-复制ie临时文件夹下所有mp3文件到指定目录,并且将utf8编码转换过来
- 将文件移动到指定目录下,并且加上时间戳进行重命名
- WPF 获取指定目录下的图片文件,然后进行切割
- 删除指定时间前目录下生成的所有文件、文件夹
- 这是一个定时脚本,主要功能是遍历该文件夹下的所有文件并存储到数组,对数据中的文件进行操作,一个一个移动到指定的目录下,并删除原有文件