A script for automated incremental backups using Python and batch files. This solution maps network drives, runs a Python script to back up files incrementally, and disconnects the drives after the backup.
- Incremental Backup: Copies only new or modified files since the last backup.
- Supports Network Drives: Maps drives using batch scripts for seamless network access.
- Logging: Logs all backup activities for easy debugging and monitoring.
- Python: Ensure Python 3.x is installed. Download from python.org.
- Network Access: Ensure the source and destination folders are accessible over the network.
- Clone the repository:
git clone https://github.com/<your-username>/incremental-backup-solution.git
Follow these steps to schedule your .bat
file for automated execution:
- Press
Win + S
and search for Task Scheduler, then open it. - In the left pane, click on Task Scheduler Library.
- In the right pane, click on Create Task.
- In the General tab:
- Name: Enter a name for your task (e.g.,
Backup Script
). - Description: Add an optional description (e.g., "Runs the backup batch script daily").
- Run whether user is logged on or not: Select this to ensure the task runs regardless of user login status.
- Run with highest privileges: Check this box if the task requires admin privileges.
- Configure for: Set to your version of Windows (e.g., "Windows 10").
- Name: Enter a name for your task (e.g.,
- Go to the Triggers tab.
- Click New.
- In the New Trigger window:
- Choose when to start the task (e.g., Daily).
- Set the Start date and time.
- Configure recurrence (e.g., every day, weekly, or a specific schedule).
- Click OK to save the trigger.
- Go to the Actions tab.
- Click New.
- In the New Action window:
- Action: Select Start a Program.
- Program/script: Enter the full path to your
.bat
file. For example:E:\Backuper\backup_script.bat
- Leave Add arguments and Start in blank unless required.
- Click OK to save the action.
- After creating the task, locate it in the Task Scheduler Library.
- Right-click on the task and select Run.
- Confirm that the task executes as expected (e.g., check the backup files or logs).
- Enable task history:
- In Task Scheduler, right-click Task Scheduler Library → Enable All Tasks History.
- View task history for logs in case of errors.
- Mapped Drives Not Found: If the script relies on mapped drives (e.g.,
B:
,S:
), ensure they are explicitly mapped in the.bat
file usingnet use
. - Task Runs but No Output: Check the "History" tab in Task Scheduler or review any logs generated by the
.bat
file. - Task Fails with Permission Errors: Ensure the task is set to Run with highest privileges in the General tab.
This guide ensures your .bat
file will run automatically on a schedule using Windows Task Scheduler. For any questions or issues, refer to the Issues section in this repository. 😊