1

How can I make this filepath

zip.write (userhome+'\\thefolder\\') 

zip every single file in "thefolder" for example how could I add a wildcard of sorts to the end like this:

zip.write (userhome+'\\thefolder\\*') 

1 Answer 1

1

shutil.make_archive does it:

shutil.make_archive( base_name = '/tmp/myBackup.zip', format = 'zip', root_dir = userhome+'\\thefolder\\', base_dir = './' ) 
Sign up to request clarification or add additional context in comments.

1 Comment

How would I add more files or directories to be zipped to this? Adding another after the comma in "root_dir = userhome+'\\thefolder\\',userhome+\\theotherfolder\\" doesn't work.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.