Skip to content

Instantly share code, notes, and snippets.

@exemplum100
Created July 16, 2023 09:10
Show Gist options
  • Save exemplum100/cf3caedb5215482e9e0e9c89d8bc7355 to your computer and use it in GitHub Desktop.
Save exemplum100/cf3caedb5215482e9e0e9c89d8bc7355 to your computer and use it in GitHub Desktop.
Zip something
import os
import shutil
import pprint
from datetime import datetime
#upd stamp
with open("lastupd.txt", "a") as f:
x = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
f.write(x + '\n')
f.close
#del old dir from copy stage
try:
shutil.rmtree('./DescArc')
except:
pass
#Copy dir (from/to)
shutil.copytree('../PyDir', './DescArc')
print('\nAFTER:')
pprint.pprint(os.listdir('./DescArc'))
#zip it!
shutil.make_archive('DescSendArc', 'zip', 'DescArc')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment