0

I'm wondering if it's possible to remove a parent directory using PCLZip while the archive is loaded; without extracting it first and recompiling it.

I can remove the parent directory in the archive using:

$zip->delete(PCLZIP_OPT_BY_INDEX, '0');

And the zip listContent seems to show the parent directory removed

but when I browse the loaded archive the child files and folders are still hosted in the parent directory. I believe this is because their structure definitions still contain the parent directory.

atwellpub
  • 5,660
  • 11
  • 38
  • 52

1 Answers1

0

This should not be possible - for all entries in ZIP archive the path is stored fully, including all parent directories. So to remove part of this path will require to process all entries, and re-write an archive file since data in all entry headers will be changed.

Nickolay Olshevsky
  • 13,706
  • 1
  • 34
  • 48