Synchronization
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 or JavaScript 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.
Syntax:
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.
Using Node.js
You may also compile the script to JavaScript:
solj synchro source target
And run it directly with Node.js:
node synchro.js source target
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.
Syntax:
solp dsync [-v | -d | -u] source target ftpfolder
or:
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.
Downloads
All scriptol sources and PHP or JS executables are included.
- Synchro for Scriptol 2. Source compiled with the last versions of the Scriptol to PHP or JavaScript compilers. To run the JavaScript version, Node.js must be installed.
- Synchro archive. For Scriptol 2001.