Using your example it would make more sense to simply copy
foo.txt as
bar.txt instead of extracting it twice...
So the issues/requirements you are facing at this point are:
- I have to extract a zip file exactly in the order the files are present in the zip
- I must extract the file from the archive twice as i cannot copy the extracted version to the second location
Forgive me, but I don't understand. I would gladly offer whatever help I can provide, but this problem your facing doesn't make sense... please clarify
PS.
It's really a lot easier, and the files need to be extracted twice are really small, to extract some members twice, rather than storing which member already has been extracted and reuse those files and cleaning up later etc. .
For what its worth, how about this approach:
1. Obtain your "special" ordering of your zip file members.
my @member_order = $zip->members();
2. Extract the entire archive to a directory.
$zip->extractTree( 'stuff', '/tmp' );
3. Process/reprocess the files in the extracted temp directory as required, based on their order within
@member_order
If this approach is unsuitable, why not?