A set of scripts for making a backup of the content of a directory, including all sub-directories.
They are written in Scriptol and compiled in PHP and thus are widely portable.
This script may be used to update a website in a differed mode. For a direct update, use the PHP FTP Synchronizer instead.

Synchronizing two local directories

The script compares two directories with their sub-directories. If the file doesn't exist in the target directory, it is copied. And aslo if the sizes differ, else the contents of the files are compared and if they differ, the copy is performed.
Empty folders are created in the target directory.


solp synchro [-v | -d] source target

If Scriptol is not available on your operating system, use directly the PHP script:

php -q synchro.php source target

Options and parameters:

-d: Display only, the operations are displaying but nothing is really changed.
-v: Verbose. Display the commands and accomplish them.
source: the directory to copy.
target: the backup.

Synchronizing offline

This script is intended to those who build a website offline and send the files by FTP on the server.
To do that, you must have an image and a backup of the site, plus another folder that holds only the files to upload. The image and the backup are compared, the backup is updated and the differences are stored into the extra folder, then you have to upload the files in this folder.
The syntax is that of the synchro script, plus an extra parameter for the additional folder.


solp dsync [-v | -d | -u] source target ftpfolder 
php dsync.php source target ftpfolder 

Extra parameter and option:

ftpfolder: directory with sub-directories where are stored the files to upload.

-u update. The content of the storage directory is erased before each new synchronization in order to avoid it to be uploaded again. With this option it is not erased, it is for the case where the content would not been uploaded since the last synchronization.

Take note that you can not execute the command twice, once the backup directory is updated, there is no mean to know which files have to be uploaded but the content of the ftp folder that is cleared at the beginning of the process.