EldoS | Feel safer!

Software components for data protection, secure storage and transfer

ZipWriter/Zipreader no FullPath extract option

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
#13304
Posted: 05/14/2010 06:02:18
by Luis Concepcion (Standard support level)
Joined: 07/21/2007
Posts: 9

Hi!

When extracting files using ZipWriter or ZipReader component, the full original path is respected, so if I zip a complete directory (c:\dir), it will be extracted to "c:\whatever\dir\..".

Is it possible to avoid this and extract files excluding the original root path? For example, if I want to extract files to "c:\another" directly?

Thanks!
#13307
Posted: 05/14/2010 06:19:09
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

Hi. Yes, you should extract all entries of that dir, i.e. something like the following:

Code
for i := 0 to zipReader.Directory.Entries[0].EntriesCount - 1 do
  zipReader.Extract(zipReader.Directory.Entries[0].Entries[i], 'C:\another');


Or, if your directory contains only files, you can do it via one call:

Code
zipReader.Extract('dir\*.*', 'C:\another');

Reply

Statistics

Topic viewed 1012 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!