[delphizip] CopyZippedFiles

  • From: "Schützmann, Peter" <Peter.Schuetzmann@xxxxxxxxxx>
  • To: delphizip@xxxxxxxxxxxxx
  • Date: Mon, 25 Nov 2002 17:35:00 +0100

Hallo Everyone,
I have a small problem with the function "CopyZippedFiles". I want to
transfer the whole
content of a Zipfile(Source) to an other Zipfile(Destination). The =
function
(see below)
works without any problems. But after that i want to delete the =
sourcefile
with the result
that i got an error: Can't delete file, because an other process had =
opend
the file.
It seems to me that the function "CopyZippedFiles" forgot to
close(Fileclose) the sourcefile.
Does anyone had this problem? I would appreciate any help.

Thank You
Peter Sch=FCtzmann


Here you can see my Function: =20

//**********************************************************************=
****
*********************

function TForm1.zipfilecopy(zipfile1,zipfile2:string):boolean;

var  Katalog    : TStringList;
     i          : integer;

begin
  result:=3Dfalse;

  ZipMaster.ZipFileName:=3Dzipfile1;
  ZipMaster.TempDir:=3DGetTempDir;
  ZipMaster.ExtrOptions:=3DZipMaster.ExtrOptions+[ExtrDirNames];
  ZipMaster.list;

  if ZipMaster.Count>1 then begin
     Katalog:=3DTStringList.Create;
     for i:=3D0 to ZipMaster.Count-1 do begin
         katalog.Add(ZipDirEntry(ZipMaster.ZipContents[i]^).FileName);
     end;
  end
  else begin
     exit;
  end;

  if katalog.count>1 then
     ZipMaster.FSpecArgs.Clear;
     ZipMaster.FSpecArgs.AddStrings(katalog);

     ZipMaster1.ZipFileName :=3Dzipfile2;
     Zipmaster1.TempDir:=3DGetTempDir;
     Zipmaster1.FSpecArgs.Clear;

  if ZipMaster.CopyZippedFiles(ZipMaster1, false, OvrAlways)<>0 then =
begin
     Showmessage('Error');
  end
  else begin
     result:=3Dtrue;
  end;

  result:=3Dtrue;
  katalog.free;
end;
//**********************************************************************=
****
*********************

Other related posts: