Skip to content

Instantly share code, notes, and snippets.

@brunomsantiago
Last active December 28, 2021 16:15
Show Gist options
  • Save brunomsantiago/6e00fb8ba7e02945e6e37adba0e7fa2b to your computer and use it in GitHub Desktop.
Save brunomsantiago/6e00fb8ba7e02945e6e37adba0e7fa2b to your computer and use it in GitHub Desktop.
from zipfile import ZipFile
def create_zip_with_fake_files(zip_filepath, fake_file_list):
with ZipFile(zip_filepath, 'w') as zip_archive:
for relative_filepath in fake_file_list:
zip_archive.writestr(relative_filepath, 'a')
def main():
fake_files = [
r'file0.txt',
r'folder_A\file1.jpg',
r'folder_A\file2.mp4',
r'folder_B\file3.docx',
r'folder_B\file4.csv'
]
create_zip_with_fake_files('test.zip', fake_files)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment