1. Go to this page and download the library: Download diegobvasco/php-rsync 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/ */
$result = (new Rsync())
->copy('/path/to/source', '/path/to/destination')
->delete()
->run();
use DiegoVasconcelos\Rsync\Rsync;
use DiegoVasconcelos\Rsync\Output\TerminalOutput;
// Print each file action to the terminal as it happens
$result = (new Rsync(new TerminalOutput()))
->copy('/path/to/source', '/path/to/destination')
->delete()
->run();
// Output:
// COPY new-file.txt (2.5 KB)
// DELETE old-file.txt
// SKIP unchanged.txt
$result = (new Rsync())
->copy('/path/to/source', '/path/to/destination')
->delete()
->dryRun()
->run();
// No files are actually copied or deleted, and the filesystem is never
// mutated (no copies, no deletions, no empty-directory cleanup).
echo $result->summary();
$result->copiedCount(); // Number of files copied
$result->deletedCount(); // Number of files deleted
$result->skippedCount(); // Number of files skipped
$result->totalBytesCopied(); // Total bytes copied
$result->copiedPaths(); // Array of copied file paths
$result->deletedPaths(); // Array of deleted file paths
$result->skippedPaths(); // Array of skipped file paths
$result->summary(); // Human-readable summary string
new Rsync(?Output $output = null, ?Filesystem $filesystem = null)
new TerminalOutput(?resource $stream = null)
$output = new TerminalOutput(fopen('php://memory', 'r+'));
use DiegoVasconcelos\Rsync\Filesystem\InMemoryFilesystem;
use DiegoVasconcelos\Rsync\Rsync;
$fs = new InMemoryFilesystem();
$fs->put('/src/app.php', ' echo 1;');
$result = (new Rsync(null, $fs))->copy('/src', '/dest')->run();
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.