You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
steam-rollback/generate_zip.py

23 lines
819 B
Python

import os
import zipfile
# Input directory containing the files
input_dir = "old_steam/"
zip_file_name = "old_steam"
# Output directory for generated header files
output_dir = "steam-rollback/resources/"
# Create the output directory if it doesn't exist
os.makedirs(output_dir, exist_ok=True)
with zipfile.ZipFile(output_dir + zip_file_name + ".zip", 'w') as zipf:
for root, _, filenames in os.walk(input_dir):
for filename in filenames:
file_path = os.path.join(root, filename) # Construct the full path
print(f"Adding file into zip: {file_path}")
zipf.write(file_path, os.path.relpath(file_path, input_dir)) # Add the file to the zip archive
print(f"All files added to the zip, generating file...")
print(f"Generated zip file: {output_dir + zip_file_name}.zip")