Welcome to our Incremental Backup System! This Python application is designed to create incremental backups from a source directory to a destination directory, such as a pendrive, ensuring that only modified files are copied. It saves time and storage space by avoiding unnecessary data duplication. This project is based on Python 3.10 and is perfect for anyone looking to maintain an efficient and automated backup system.
- os, for directory and file operations
- shutil, for file copying
- datetime, for handling file modification times
- Windows (This code was developed and tested on a Windows environment, but it can be adapted for other platforms)
The Incremental Backup System works by analyzing the source directory and the destination directory (e.g., pendrive) and copying only the files that have been modified since the last backup. Here's how it operates:
-
Data Initialization: The system initializes and maintains a record of the modification times of files in the source directory using a dictionary.
-
File Comparison: For each file in the source directory, the system checks whether it exists in the destination directory and if it does, it compares the modification time with the stored time. If the file is new or has been modified, it is copied to the destination directory.
-
File Copying: Files that need to be updated are copied from the source directory to the destination directory using the
shutil.copy2
function, which preserves file metadata. -
Summary: After the backup process is complete, the system provides a summary of the total number of files modified and copied.
Before you begin, ensure you have met the following requirements:
- Python 3.10 or higher is installed on your system.
To use this incremental backup system, follow these steps:
-
Clone the repository to your local machine:
git clone https://github.com/your-username/incremental-backup-system.git
-
Open the
backup.py
file and set thesource_dir
andpendrive_dir
variables to point to your source and destination directories. -
Run the backup system:
python backup.py
The system will create incremental backups, ensuring that only modified files are copied, making it an efficient solution for your backup needs.
If you would like to contribute to this project, please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and test them.
- Commit your changes with clear and concise commit messages.
- Push your branch to your fork.
- Create a pull request to the main repository's
main
branch.
This project is licensed under the MIT License - see the LICENSE file for details.
Thank you for considering our Incremental Backup System. We hope this tool helps you maintain a well-organized and efficient backup strategy. If you have any suggestions or feedback, please feel free to reach out. Your input is greatly appreciated!