How to take automate backup using python on local system...?

Prem ChoudharyPrem Choudhary
1 min read

First what is backup?
Backup means ๐Ÿ“(File)โ†’ Compress โ†’ Copy โ†’ Save.

import shutil
import datetime
import os
def backup_files(source,destination):
    today=datetime.date.today()
    backup_filename=os.path.join(destination,f"backup_{today}")
    stutil.make.archive(backup_filename,'gztar',source)

source="path/to/source_file"
destination="path/to/destination_file"

backup_files(source,destination)
0
Subscribe to my newsletter

Read articles from Prem Choudhary directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Prem Choudhary
Prem Choudhary

DEVOPS ENGINEER || AWS || JAVA || PYTHON || SPRING BOOT || SPRING SECURITY || REACT.JS || MONGO DB || MYSQL