怎么用Delphi7实现文件夹的压缩
发布网友
发布时间:2022-07-10 11:37
我来回答
共1个回答
热心网友
时间:2022-07-13 00:56
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;