Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract 提取的时候,可以不提取文件夹吗 #34

Closed
demacia666666 opened this issue Dec 1, 2019 · 2 comments
Closed

Extract 提取的时候,可以不提取文件夹吗 #34

demacia666666 opened this issue Dec 1, 2019 · 2 comments
Assignees
Milestone

Comments

@demacia666666
Copy link

extractor.extract 提取文件的时候,能把其中的文件夹去掉吗

@rikyoz
Copy link
Owner

rikyoz commented Dec 5, 2019

Hi.
Sorry but I do not speak Chinese, so I had to use Google Translate, I hope I understood your issue all the same.
If I'm not mistaken, you want to extract only the files, not the folders, from an archive.
However, I'm not sure which of the following two cases you are referring to:

  • Extract all the files in an archive, including those inside folders, but without maintaining the structure of the directories. Unfortunately, this is not (yet) possible with bit7z, as it always tries to recreate the folder tree as it is in the archive. However, it is a potentially useful functionality, and I hope to implement it in the next version of the library.

Or

  • Extract all files, ignoring folders and their contents.
    In this case, although bit7z does not directly implement this feature, you can achieve the same effect by using BitExtractor::extractMatchingRegex(...) with the Regular Expression ^[^/\\]+$: such regex matches only archive's files not having \ or / in their path (hence they are not contained in any folder!).

@rikyoz rikyoz self-assigned this Dec 6, 2019
@rikyoz rikyoz added this to the v4.0 milestone Dec 6, 2019
@rikyoz
Copy link
Owner

rikyoz commented Oct 1, 2023

Implemented in v4.0.0.

@rikyoz rikyoz closed this as completed Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants