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

Exclude files from being zipped #176

Closed
JarFiles opened this issue Apr 30, 2020 · 6 comments
Closed

Exclude files from being zipped #176

JarFiles opened this issue Apr 30, 2020 · 6 comments
Assignees
Labels
new-feature New feature or request resolved

Comments

@JarFiles
Copy link
Contributor

Hey,
I wanted to know if it's possible to exclude files from being zipped.
For example:
ZipFile#addFolder adds all files and it's subdirectories to the zip file.
But there are a few files which I just don't want being added. I tried getting all files manually and then using ZipFile#addFiles but now all files end up being in the root directory of the zip file. Is there a way to keep the folder structure in the zip file?

@fatmyxtap
Copy link

fatmyxtap commented May 3, 2020

Hi all, I have this problem too, I tried to find workaround and I prepared all files which I want to zip as ArrayList and executed ZipFile#addFiles, but my structure of directories was broken inside the zip file. I believe we can save structure and we can exclude some files or directories too.

@JarFiles Did you find any solution or workarounds?

@JarFiles
Copy link
Contributor Author

JarFiles commented May 4, 2020

I'll try to add it to the src and create a pull request later

@srikanth-lingala
Copy link
Owner

PR merged. Issue to add tests created #189 . I will add tests before I release this feature.

@srikanth-lingala
Copy link
Owner

srikanth-lingala commented May 20, 2020

I have added tests. And also, I made some changes to the PR which was merged:

  • Renamed ExcludeFileHandler to ExcludeFileFilter
  • Moved ExcludeFileFilter from ZipParameters to method argument in ZipFile.addFolder(), as this feature is only available when adding a folder to the zip file (See comment below)

@srikanth-lingala
Copy link
Owner

Actually, after some more thoughts, I moved the filter back to ZipParameters, because as part of an upcoming feature in #84, it will be possible to add folders also with ZipFile.addFiles() method. In this case, it will be useful to have this filter in ZipParameters.

@srikanth-lingala
Copy link
Owner

Feature added in v2.6.0 released today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature New feature or request resolved
Projects
None yet
Development

No branches or pull requests

3 participants