PHP code example of albertofem / rsync-lib
1. Go to this page and download the library: Download albertofem/rsync-lib library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
albertofem / rsync-lib example snippets
use AFM\Rsync\Rsync;
$origin = __DIR__;
$target = "/target/dir/";
$rsync = new Rsync;
$rsync->sync($origin, $target);
use AFM\Rsync\Rsync;
$origin = __DIR__;
$target = "/target/dir";
$config = array(
'delete_from_target' => true,
'ssh' => array(
'host' => 'myhost.com',
'private_key' => '/my/key'
)
);
$rsync = new Rsync($config);
// change options programatically
$rsync->setFollowSymlinks(false);
$rsync->sync($origin, $target);