Simplified incremental backup
In the first part, we saw how to make a simple and effective backup using an archiver.
In this case, an archive is created for each backup. This is the safest solution, it allows you to go back in time to find the modified files, the original form of which we would like to return.
Incremental backup does not have this benefit, but it saves space and is suitable for more frequent backups.
The main difference between the code is that we no longer need to create a file name and this frees us from getting the date and time, as well as from finding them.
The archive name is specified in the source code.
The archiver command changes, instead of "a" for adding, the code "u" is used for updating (updating).
text command = "7z u -tzip $target "
Using the program
Extract content from backup to disk root. The script will be available on the command line in the/seb/directory.
Place 7z.exe and 7z.dll in a directory that takes into account the PATH variable, which allows you to run these programs from any directory. This can be in the/seb/directory.
As with a simple backup, the list of files to be backed up is assigned in the saving table.
array saving = [
....noms séparés par une virgule
]
Examples:
array saving = [ "w:/scriptol.com/", "p:/scripts/" ]
If necessary, select a name for the archive. By default, it is called "backup-increental.zip."
text archive = "backup-incremental"
Runs a script that specifies the target drive or directory. If the directory does not exist, it will be created automatically.
Command in JavaScriot:
node sebi.js d:
Command in PHP:
php sebi.php d:/temp/
Restore saved files
As explained in the first part, you can restore all or part of the saved files either using the command line, or using Archive Manager or directly using Windows Explorer.