文件管理 · 2022年7月25日

delphi压缩文件夹|怎么用Delphi7实现文件夹的压缩

1. delphi7关于文件夹压缩的问题.

procere TForm1.RzBitBtn1Click(Sender: TObject);var FilesCompressed: Integer;begin Zip1.Switch := swAdd; Zip1.FileSpec.Clear( ); Zip1.FileSpec.Add( 'E:\1\*.*' ); //要压缩的文件 Zip1.ArchiveFile := 'E:\11111.zip'; //压缩后的文件 FilesCompressed:= Zip1.Compress;end;

2. 在DELPHI中如何实现文件的“压缩和解压”

Delphi自带有压缩包,但是,没有安装,我写了个调用程序,如果你需要,我的Email:[email protected]

3. delphi 怎么来压缩文件

在 delphi 里有多种方式来压缩文件:

1、直接调用系统的压缩软件,比如 winrar,用 ShellExecute / Winexec 执行命令行:

"C:/ProgramFiles/WinRAR/WinRAR.exe"a "d:c.rar""D:Music"

2、使用 delphi 提供的单元文件 zlib.pas 中相关的压缩函数:

示例代码:

//压缩函数procereZip(varfs:TMemoryStream);varcs:TCompressionStream;ms:TMemoryStream;num:Integer;beginifnot(Assigned(fs)and(fs.Size>0))thenExit;num:=fs.Size;ms:=TMemoryStream.Create;cs:=TCompressionStream.Create(clMax,ms);tryfs.SaveToStream(cs);cs.Free;//ms.Position:=0;fs.Clear;fs.WriteBuffer(num,sizeof(num));fs.CopyFrom(ms,0);finallyms.Free;end;end;

3、使用专门的压缩控件,如VCLZip 等。

4. 如何使用delphi调用7zip压缩解压缩

e 解压压缩文件到当前目录忽略路径解压压缩的文件到当前或指定的文件夹。此命令行对应的是 压缩文件管理 命令 解压到指定文件夹 并在 解压路径和选项对话框 “不解压路径”的选项是启用时。例子:在当前文件夹,从全部的 RAR 压缩文件解压所有的 *.doc 文件到当前文件夹WinRAR e *.rar *.doc

5. 怎么用Delphi7实现文件夹的压缩

var dbpathname:string; AccessEngine :DBEngine;begin AccessEngine:=CoDBEngine.Create; with dm_zt.Query_ZhTao do begin dbpathname:=fieldbyname('db_pathname').asstring; end; if FileExists(dbpathname) then begin try try AccessEngine:=CoDbEngine.Create; if FileExists(extractfilepath(dbpathname)+'tempback.dat') then deletefile(extractfilepath(dbpathname)+'tempback.dat') else begin AccessEngine.CompactDatabase(dbpathname,extractfilepath(dbpathname)+'tempback.dat','',0,';pwd=B102901010816'); DeleteFile(dbpathname); renameFile(extractfilepath(dbpathname)+'tempback.dat',dbpathname); end; except ShowMessage('压缩失败'); // raise; end; finally ShowMessage('压缩成功'); end;

6. Delphi 解压文件

很简单吧,先不带密码尝试解压一次或者获取信息一次,如果失败了就说明有密码咯。代码:procere TForm1.btn1Click(Sender: TObject);beginUnZip1.OnBadPassword:=UnZip1BadPassword;UnZip1.ArchiveStream:=TFileStream.Create('F:\古书.zip',fmOpenRead);if UnZip1.CheckArchive then begin showmessage('No Pass'); UnZip1.ArchiveStream.Free; exit; //无密码,不解压 end;//解压过程,略。UnZip1.ArchiveStream.Free;end;procere TForm1.UnZip1BadPassword(Sender: TObject; FileIndex: Integer; var NewPassword: String);beginNewPassword:='123456'; //123456是真实的密码,这一步可以省end;

7. delphi7如何实现解压与压缩包括用到的dcu

zlib可以实现流压缩。ziptv可以实现文件压缩,都是现成的控件,直接使用即可。

8. 谁会用delphi写解压程序(zip文件)

呵呵,如不雅安装了winzip这个软件,可以用它的dll来实现:wzcab3.dllwz32._initunzipunzip_._initCAB_.dllZAMEntryPoint1呵呵,这个由kingron供给的。

9. delphi XE 10 解压压缩文件

没有的,可以在前端要求加个判断格式,只有ZIP的才行。或都把.rar的自己转换成zip