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

A clear example for archiving whole folders and subfolders would be nice #22

Open
michel4j opened this issue Oct 27, 2016 · 1 comment

Comments

@michel4j
Copy link

michel4j commented Oct 27, 2016

The example in README seems to imply that simply doing z.write('/path/to/files/') is sufficient but that generates empty archives. Something like:

    z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
    for root, dirs, files in os.walk(path):
        for filename in files:
            file_path = os.path.join(root, filename)
            arcpath = os.path.join(path, os.path.relpath(file_path, path))
            z.write(file_path, arcpath)

@manuelep
Copy link

I was just trying to do it. I made it just yesterday with an old version of ZipStream and it was more intuitive. Maybe an alternative method to write could be implemented that do exacly what showed in the example.
Thank you @minkwe and to all authors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants