Usando a System.ZIP para gerar arquivo ZIP
[code lang=”pascal”]
uses System.ZIP;
function CriarZipFile(FZipFile, AFileName: string): integer;
var
z: TZipFile;
begin
result := 0;
z := TZipFile.Create;
try
if fileExists(FZipFile) then
z.Open(FZipFile, zmReadWrite)
else
z.Open(FZipFile, zmWrite);
z.Add(AFileName, extractFileName(AFileName));
z.Close;
result := 1;
finally
z.Free;
end;
end;
[/code]