3

I am using shutil.make_archive function to make archive

But it only archive the contents of directory. i have the folder to backup like root_dir = /home/john/public_html

I use that then my archive contains the contents of public_html but i want to include public_html itself in archive.

Now in my john folder i have many other folders as well that i don't want to backup so i can't use /home/john

1 Answer 1

4

You want to pass the base_dir argument, as mentioned in the docs:

shutil.make_archive('public_html_backup', 'zip', '/home/john', '/home/john/public_html')
Sign up to request clarification or add additional context in comments.

1 Comment

do base_dir has to be the full path or it is realtive to the root path. i mean public_html or /home/john/public_html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.