PHP code example of withaspark / backblaze-sync
1. Go to this page and download the library: Download withaspark/backblaze-sync 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/ */
withaspark / backblaze-sync example snippets
$b2 = new withaspark\BackblazeSync\BackblazeSync($bucket, $local_dirs);
$existing = $b2->getExistingFiles(); // Get all files currently in bucket
$files = $b2->getFilesInDir(); // Get all files in local directory
$b2->deleteDuplicateRemoteFiles(); // Delete duplicate files in bucket
foreach ($files as $file) {
$b2->upload($file); // Upload files if new
}
$b2->getUploadedCount(); // Get number of local files uploaded to B2 this run
$b2->getDeletedCount(); // Get number of remote files deleted from B2 this run