Windows / Data Differential Backup from Command Line -- Possible ?


  1. Posts : 11,247
    Windows / Linux : Arch Linux
       #1

    Windows / Data Differential Backup from Command Line -- Possible ?


    Hi folks
    I was wondering if some powershell expert would know if it's possible to create a daily differential backup from the command line and then run it as an automated daily command. Primarily for DATA not the OS backup.

    It might even be possible to do it in the WSL -- would be great if that worked.

    The thing is it's so simple in Linux -- just this script will do it :

    #!/bin/bash

    DAY=$(date +%A)

    if [ -e /location/to/backup/incr/$DAY ] ; then
    rm -fr /location/to/backup/incr/$DAY
    fi

    rsync -a --delete --quiet --inplace --backup --backup-dir=/location/to/backup/incr/$DAY /path/to/backup/ /location/to/backup/full/

    there's no reason also why this couldn't be started from a remote system (Windows or otherwise) via SSH - note Windows has openssh both client and server available -- the server version has to be enabled via the "add optional feature" - the client is already installed by default.

    Messing around with things like Macrium differentials is OK on an individual machine but if one wants to save say backups to a NAS server from 8 / 9 laptops or clients then a nice simple automated script centrally administered seems t he way to do it.

    I'm not suggesting in any way that users don't image their OS regularly but handling differential DATA file backups would give them a nice bit of extra functionality and the data volumes wouldn't be large in any case (and over a 10Gb LAN the traffic wouldn't kill it.).


    Cheers
    jimbo
      My Computer


  2. Posts : 5,330
    Windows 11 Pro 64-bit
       #2

    I have a batch script allows you to do incremental backup.
    Windows  / Data Differential Backup from Command Line -- Possible ? Attached Files
      My Computer


  3. Posts : 7,607
    Windows 10 Home 20H2
       #3

    If you want a mirror backup, use the following:

    Robocopy "D:\Source" "E:\Destination" /Mir
      My Computer


  4. Posts : 31,691
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #4

    jimbo45 said:
    ..if it's possible to create a daily differential backup from the command line and then run it as an automated daily command. Primarily for DATA not the OS backup.

    In addition to making regular Macrium images I have a batch file I use to perform a full or incremental copy of my data files to a network share. I run it manually, but there's no reason why it couldn't be scheduled.

    The key to only backing up files that have changed since the last backup is to use the /M option, available in both Xcopy and RoboCopy.

    Xcopy /?
    /M Copies only files with the archive attribute set,
    turns off the archive attribute.


    RoboCopy /?
    /M :: copy only files with the Archive attribute and reset it.

    To make a full backup I first use the command attrib +A *.* /s to set the Archive attribute on all files.
      My Computers


  5. Posts : 11,247
    Windows / Linux : Arch Linux
    Thread Starter
       #5

    Bree said:
    In addition to making regular Macrium images I have a batch file I use to perform a full or incremental copy of my data files to a network share. I run it manually, but there's no reason why it couldn't be scheduled.

    The key to only backing up files that have changed since the last backup is to use the /M option, available in both Xcopy and RoboCopy.

    Xcopy /?
    /M Copies only files with the archive attribute set,
    turns off the archive attribute.


    RoboCopy /?
    /M :: copy only files with the Archive attribute and reset it.

    To make a full backup I first use the command attrib +A *.* /s to set the Archive attribute on all files.
    Hi there
    Thanks good idea -- need to send backups to a NAS.

    BTW any easy way for a user then to retrieve files from backup -- so they can do it themselves and not hose anything up on the server. Assume they've used the xcopy / robocopy option to create the backup. The server can send them back the file name of their backup - that's not an issue.

    Cheers
    jimbo
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 09:53.
Find Us




Windows 10 Forums