Replies: 3 comments 3 replies
-
Hi! extractor.extractMatching( "path/to/archive.7z", "/data/1/2/*", "out" ); Unfortunately, there's no equivalent method in At the moment, with std::vector< std::uint32_t > matchingIndices;
for ( const auto& item : reader ) {
if ( item.path().rfind( "data/1/2/", 0 ) != 0 ) { // Or C++20's starts_with method.
matchingIndices.push_back( item.index() );
}
}
reader.extractTo( "out", matchingIndices ); |
Beta Was this translation helpful? Give feedback.
-
I tried the BitFileExtractor method
If I use 7zip to open the archive, I see that there are files in that path within the archive, but nothing is extracted to disk when I run that function. Is there a return value for this function, or a way to tell if it successfully matched any files in the archive? |
Beta Was this translation helpful? Give feedback.
-
That worked! Thank you
…On Mon, Jan 13, 2025 at 3:39 PM Riccardo ***@***.***> wrote:
Sorry, I forgot a few details in my previous comment.
First, 7-Zip *usually* reports the paths of items inside archives without
the / prefix. There are some edge cases (e.g. if the / is explicitly
specified for the item name when creating the archive), but this is
unlikely to be your case.
Second, 7-Zip reports the paths of items inside archives using the OS
native path separator, which is \ on Windows.
So on Windows, this should be the correct code:
extractor.extractMatching("pathTo.7z", "data\\1\\2\\*",
"C:/temp/data/1/2");
If I use 7zip to open the archive, I see that there are files in that path
within the archive, but nothing is extracted to disk when I run that
function. Is there a return value for this function, or a way to tell if it
successfully matched any files in the archive?
This is strange, as the function should throw an exception if no match is
found in the archive.
—
Reply to this email directly, view it on GitHub
<#270 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7K5B7HPNCJFPEVVWPV4ZD2KQP77AVCNFSM6AAAAABU4THTXCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOBSGQ2TGOA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
If I have an archive with paths, such as:
data
data/1
data/1/2
How would I extract all the files stored in data/1/2 into a directory on disk?
Beta Was this translation helpful? Give feedback.
All reactions