in reply to Re: how to extract zip files to specified location
in thread how to extract zip files to specified location
I think indeed either extractMember or extractMemberWithoutPaths, where you first construct the full path for the new file, from the old member name.
Actually, I think Archive::Zip could use an edit, where you could pass a path to a directory (either an existing directory or a path that ends in a slash/backslash/other directory separator), which would then serve as a root dir for the extraction. It currently doesn't do that, the optional path must include the file name.
So, the OP needs to add some code constructing the new path name out of the member name, and use that as a second parameter to extractMember.
You can retrieve the internal path for a member by using the snippet
$name = $member->fileName();
Do ZIP archives use absolute or relative paths? If it's relative path, it'll use the current directory as the root dir. In that case it's easy: just chdir to the directory that you want to use as the root for the decompressed archive.
|
|---|