This Python script allows you to back up files from a source directory to a destination directory. It provides options to either create a zip archive of the source files or copy them directly to the destination.
- Python 3.x
os
,sys
,shutil
,logging
,datetime
modules
-
Clone Repository: Clone this repository to your local machine.
-
Install Python: Make sure Python 3.x is installed on your system.
-
Dependencies: Install required Python modules using pip:
pip install -r requirements.txt
Execute the script in your terminal or command prompt:
```bash
python backup_script.py
-
Enter the absolute path of the source directory.
-
Specify the destination directory or create one if it doesn't exist.
-
Choose between creating a zip archive (1) or copying files directly (2).
- The script will perform the selected backup operation.
- Logs are stored in
backup.log
detailing backup success or errors.
- Automated Timestamps: Each backup operation is timestamped for the organization.
- Error Handling: Logs errors encountered during the backup process.
- Interactive Interface: Guides users through directory selection and backup type.
$ python backup_script.py
File Backup has started
Please enter the source path(Absolute path): /path/to/source
Please enter the Destination path(Absolute path): /path/to/destination
Files and folders in source file are:
- file1.txt
- file2.jpg
Total number of files in source: 2 files
Enter the type of backup:
1. Making an archive
2. Copying all files into destination.
Enter your choice(1-2): 1
Backup created successfully at /path/to/destination/backup_20240629_164530_123456.zip