Created
December 11, 2022 07:33
-
-
Save tnq177/c399823c5a1f00acf1751ce139c359bc to your computer and use it in GitHub Desktop.
properly zip a folder to anki apkg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
properly zip folder to anki apkg | |
learned from https://github.com/patarapolw/ankisync2 | |
""" | |
import sys | |
from zipfile import ZipFile | |
from pathlib import Path | |
if __name__ == "__main__": | |
indir = sys.argv[1] # path to input dir contains {1...n} files + media + collection.anki2 | |
outfile = sys.argv[2] # apkg | |
with ZipFile(outfile, "w") as zf: | |
for f in indir.iterdir(): | |
zf.write(str(f.resolve()), arcname=f.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment