This script allows to back up files by "differential backup" mode (Only files that have a different hash and path will be backed up in a new "snapshot")
The script will perform a backup by creating a new directory based on the current day and by copying only the new or changed files in the destination folder. Restore functionality will restore all contents from the chosen date to the oldest by keeping the newest files
The script will create an index database to track which files have been already backed up and when performing a backup will create a new directory based on the current day and will copy only the new or changed files
test
├── backup
│ ├── IMPORTANT.txt
│ └── index.db
└── toBackup
├── 1.txt
├── 2
│ ├── 2.txt
│ └── 3.txt
└── 3.txt
test
├── backup
│ ├── 12-05-2021
│ │ └── toBackup
│ │ ├── 1.txt
│ │ └── 2
│ │ ├── 2.txt
│ │ └── 3.txt
│ ├── IMPORTANT.txt
│ └── index.db
└── toBackup
├── 1.txt
└── 2
├── 2.txt
└── 3.txt
test
├── backup
│ ├── 12-05-2021
│ │ └── toBackup
│ │ ├── 1.txt
│ │ └── 2
│ │ ├── 2.txt
│ │ └── 3.txt
│ ├── 13-05-2021
│ │ └── toBackup
│ │ ├── 2
│ │ │ └── 3.txt
│ │ └── 3.txt
│ ├── IMPORTANT.txt
│ └── index.db
└── toBackup
├── 1.txt --> same as 12-05-2021
├── 2
│ ├── 2.txt --> same as 12-05-2021
│ └── 3.txt --> different from 12-05-2021
└── 3.txt --> new file (same hash of 3.txt)
Back up directory
backup
├── 15-05-2021
│ └── toBackup
│ ├── 1.txt
│ ├── 2
│ │ ├── 2.txt
│ │ └── 3.txt --> content "ciao"
│ └── 3.txt --> content "ciao"
├── 16-05-2021
│ └── toBackup
│ ├── 2
│ │ └── 3.txt --> content "new content"
│ ├── 3.txt --> content "new content"
│ └── 4.txt
├── IMPORTANT.txt
└── index.db
Restoring 15-05-2021
restore
└── toBackup
├── 1.txt
├── 2
│ ├── 2.txt
│ └── 3.txt --> content "ciao"
└── 3.txt --> content "ciao"
Restoring 16-05-2021
restore
└── toBackup
├── 1.txt
├── 2
│ ├── 2.txt
│ └── 3.txt --> content "new content"
├── 3.txt --> content "new content"
└── 4.txt
diff-backup is a backup tool that perform incremental backup for a specific directory
Usage:
diff-backup [command]
Available Commands:
backup backup command will perform the backup of the <source> directory to the <destination> directory
help Help about any command
init init command will initialize the <source> directory that will used for backups
restore restore command will restore the backup of the <source> directory to the <destination> directory from a certain <date>
version Print the version number of diff-backup
Flags:
-h, --help help for diff-backup
Create a new backup repository
Performing backup
Performing restore
Not supporting space on <source> and <destination>