Jump to content
bnobre

TZipFile.ExtractZipFile overwrite files?

Recommended Posts

Hello everybody,

 

I'm using the class method below to extract the contents of zipped files:

 

https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.Zip.TZipFile.ExtractZipFile

 

When extracting the zip file with this method, if there are files with the same name in the destination, will they be overwritten?

 

For example:

 

image.thumb.png.3fa1c13578eed76e86a903d20d7e4556.png

 

In the directory called test, the compact.zip file and a file called file1.txt are saved.

 

The compact.zip file contains a file1.txt file.

 

When extracting the file1.txt that is inside the compact.zip, will it overwrite the file file1.txt that is saved in the directory called test?

Share this post


Link to post

@bnobre YES, it will be replaced! But you can choice "what" file need extract be do it, then, you can put in another folder, for example!

Edited by programmerdelphi2k
  • Like 1

Share this post


Link to post

Hi @programmerdelphi2k,

 

How are you?

 

Thx for your answer. 

 

In fact I really want him to replace it, but since I didn't find anything in the Embarcadero documentation I was in doubt if it really overwrites or not.

Share this post


Link to post

@bnobre try this...

var
  MyZIP: TZipFile;
begin
  MyZIP := TZipFile.Create;
  try
    MyZIP.ExtractZipFile('D:\MyZip\MyNewZip.zip', 'D:\MyZip');
  finally
    MyZIP.Free;
  end;

 

Edited by programmerdelphi2k

Share this post


Link to post

I tried,

 

He overwrote. 

 

I was just in doubt because in the Embarcadero documentation nowhere does it say that it overrides.

 

Thx

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×