Incremental Backup Simplified

In the first part, we saw how to make a simple and efficient backup using an archiver.

In this case an archive is created for each backup. This solution is the safest as it we can go back in time to find files modified and of which we want to regain the original.

The incremental backup does not have that advantage but it saves space and is suitable for more frequent backups.

The main difference in the code is that we no longer have to create a file name and it is unnecessary for us to deal with date and time, and locate them.
The name of the archive is given in the source code.

The archiver command is changed, the "u" to update code replace the "a" to add.

text command = "7z u -tzip $target " 

Using the program

Extract the contents of the archive to the root of the disk. The script will so be accessible from the command line in the directory /seb/.

Place 7z.exe 7z.dll and in a directory included in the PATH variable, which can run these programs from any directory. This may be in the /seb/ directory.

As in the case of a single backup, you assign the list of files to be saved to the "saving" array.

array saving  = [
 .... filenames separated by commas....
]

Examples:

array saving = [
"w:/scriptol.com/", 
"p:/scripts/"
] 

Choose any name for the archive. By default it is called "backup-incremental.zip".

 text archive = "backup-incremental" 

Run the script by specifying a destination directory or drive. If the directory does not exist it will br automatically created.

JavaScript command:

node sebi.js d: 

PHP command:

php sebi.php d:

Recovering saved files

As explained in the first part, we can recover some or all stored files, either at the command line, or through an archive manager or directly with Windows 7 explorer.

Download the script