Skip to content

A script for automated incremental backups using Python and batch files

Notifications You must be signed in to change notification settings

hellorahul09/Incremental-Backup-Solution-Script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Incremental Backup Solution

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.

Features

  • 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.

Prerequisites

  • Python: Ensure Python 3.x is installed. Download from python.org.
  • Network Access: Ensure the source and destination folders are accessible over the network.

Installation

  1. Clone the repository:
    git clone https://github.com/<your-username>/incremental-backup-solution.git
    

Scheduling the Task to Run Automatically (Windows Task Scheduler)

Follow these steps to schedule your .bat file for automated execution:

Step 1: Open Task Scheduler

  1. Press Win + S and search for Task Scheduler, then open it.
  2. In the left pane, click on Task Scheduler Library.

Step 2: Create a New Task

  1. In the right pane, click on Create Task.
  2. 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").

Step 3: Set the Trigger

  1. Go to the Triggers tab.
  2. Click New.
  3. 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).
  4. Click OK to save the trigger.

Step 4: Set the Action

  1. Go to the Actions tab.
  2. Click New.
  3. 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.
  4. Click OK to save the action.

Step 5: Test the Task

  1. After creating the task, locate it in the Task Scheduler Library.
  2. Right-click on the task and select Run.
  3. Confirm that the task executes as expected (e.g., check the backup files or logs).

Step 6: Enable History and Troubleshooting

  1. Enable task history:
    • In Task Scheduler, right-click Task Scheduler LibraryEnable All Tasks History.
  2. View task history for logs in case of errors.

Common Issues and Solutions

  • Mapped Drives Not Found: If the script relies on mapped drives (e.g., B:, S:), ensure they are explicitly mapped in the .bat file using net 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. 😊