All Projects → thadbryson → flysystem-sync

thadbryson / flysystem-sync

Licence: other
Filesystem sync using Flysystem project.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to flysystem-sync

ansible-role-glusterfs
Ansible Role - GlusterFS
Stars: ✭ 95 (+265.38%)
Mutual labels:  sync, filesystem, file
Write
Write data to the file system, creating any intermediate directories if they don't already exist. Used by flat-cache and many others!
Stars: ✭ 68 (+161.54%)
Mutual labels:  sync, file
Renamer
Rename files in bulk.
Stars: ✭ 240 (+823.08%)
Mutual labels:  filesystem, file
FileRenamerDiff
A File Renamer App featuring a difference display before and after the change.
Stars: ✭ 32 (+23.08%)
Mutual labels:  filesystem, file
Filehound
Flexible and fluent interface for searching the file system
Stars: ✭ 190 (+630.77%)
Mutual labels:  filesystem, file
Aiofile
Real asynchronous file operations with asyncio support.
Stars: ✭ 214 (+723.08%)
Mutual labels:  filesystem, file
fileutils
Golang file system utils such as copy files and directories
Stars: ✭ 19 (-26.92%)
Mutual labels:  filesystem, file
File Storage
File storage abstraction for Yii2
Stars: ✭ 116 (+346.15%)
Mutual labels:  filesystem, file
flutter file utils
Flutter package for managing files on Android
Stars: ✭ 35 (+34.62%)
Mutual labels:  filesystem, file
gtree
Output tree🌳 or Make directories📁 from #Markdown or Programmatically. Provide CLI, Golang library and Web (using #Wasm ).
Stars: ✭ 88 (+238.46%)
Mutual labels:  filesystem, file
cache
🥌 Deno cache library
Stars: ✭ 38 (+46.15%)
Mutual labels:  filesystem, file
Filesystem
FileSystem is an application that allows you to browse the content of your iPhone disk, displaying file and folders, files contents, and detailed informations about file and folder permissions.
Stars: ✭ 148 (+469.23%)
Mutual labels:  filesystem, file
PHP-FileUpload
Simple and convenient file uploads — secure by default
Stars: ✭ 53 (+103.85%)
Mutual labels:  filesystem, file
Copy Webpack Plugin
Copy files and directories with webpack
Stars: ✭ 2,679 (+10203.85%)
Mutual labels:  filesystem, file
Flametree
🔥 Python file and zip operations made easy
Stars: ✭ 148 (+469.23%)
Mutual labels:  filesystem, file
Go Fastdfs
go-fastdfs 是一个简单的分布式文件系统(私有云存储),具有无中心、高性能,高可靠,免维护等优点,支持断点续传,分块上传,小文件合并,自动同步,自动修复。Go-fastdfs is a simple distributed file system (private cloud storage), with no center, high performance, high reliability, maintenance free and other advantages, support breakpoint continuation, block upload, small file merge, automatic synchronization, automatic r…
Stars: ✭ 2,923 (+11142.31%)
Mutual labels:  sync, filesystem
Filesize.js
JavaScript library to generate a human readable String describing the file size
Stars: ✭ 997 (+3734.62%)
Mutual labels:  filesystem, file
Hypertag
Knowledge Management for Humans using Machine Learning & Tags
Stars: ✭ 116 (+346.15%)
Mutual labels:  filesystem, file
flysystem-curlftp
Flysystem Adapter for the FTP with cURL implementation
Stars: ✭ 36 (+38.46%)
Mutual labels:  filesystem, flysystem
mindav
A self-hosted file backup server which bridges WebDAV protocol with @minio written in @totoval. Webdav ❤️ Minio
Stars: ✭ 64 (+146.15%)
Mutual labels:  sync, file

Flysystem Sync

About

This is a wrapper for Flysystem version 2 and 3. Note that v1.* is a plugin for Flysystem v1.*.

Installation

Use Composer:

"thadbryson/flysystem-sync": ">=2.0"

Supports PHP v7.2 and up.

It helps you sync 2 directories at a time. There are two directory types.

Master

Contents of this directory are moved to Slave for writing and updating. If this folder has a path that Slave doesn't then the path on Slave is deleted.

Slave

Target directory. Where things are moved to or deleted from.

How To

Here is some example code to set everything up.

use TCB\FlysystemSync\Sync;

use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter as Adapter;

// Setup file system.
$master = new Filesystem(new Adapter(__DIR__ . '/sync-test/master'));
$slave  = new Filesystem(new Adapter(__DIR__ . '/sync-test/slave'));

// Create the Sync object. Use root directory. That '/' variable can be any subpath directory.
$sync = new Sync($master, $slave, $config = [], $directory = '/');

// Here is how to actually sync things.

// Add all folders and files ON MASTER and NOT ON SLAVE.
$sync->syncWrites();

// Delete all folders and files NOT ON MASTER and on SLAVE.
$sync->syncDeletes();

// Update all folders and files that are on both MASTER and SLAVE.
$sync->syncUpdates();

// This will do ->syncWrites(), ->syncDeletes(), and ->syncUpdates().
$sync->sync();

// And you can get what all these paths are going to be separately.

$paths = $sync->getUtil()->getWrites();  // On Master but not on Slave.
$paths = $sync->getUtil()->getDeletes(); // On Slave but not on Master.
$paths = $sync->getUtil()->getUpdates(); // On both Master and Slave but with different properties.

Example Path Array

array(2) {
    'create-dir/' => \League\Flysystem\DirectoryAttributes,
    'create-dir/3.php' => \League\Flysystem\FileAttributes
}

That's an example from a var_dump() of what a path will give you.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].