diff --git a/zip.py b/zip.py new file mode 100644 index 00000000..3ff57dff --- /dev/null +++ b/zip.py @@ -0,0 +1,18 @@ +import zipfile +import os + +files_to_zip = ['requirements.txt', 'main.py'] + +output_zip_filename = 'deploy.zip' + +# Create a ZipFile object in write mode +with zipfile.ZipFile(output_zip_filename, 'w', zipfile.ZIP_DEFLATED) as zipf: + for file_to_zip in files_to_zip: + # Check if the file exists in the current directory + if os.path.exists(file_to_zip): + # Add the file to the zip archive + zipf.write(file_to_zip, os.path.basename(file_to_zip)) + else: + print(f"Warning: {file_to_zip} not found in the current directory.") + +print(f"Files {', '.join(files_to_zip)} have been zipped to {output_zip_filename}")