phpgt/sync
最新稳定版本:v1.3.0
Composer 安装命令:
composer require phpgt/sync
包简介
Synchronise two directories.
README 文档
README
rsync is the tool of choice for ensuring that two directories have the same content, but is only present by default on Unix systems. This repository provides simple recursive directory synchronisation in plain PHP, compatible on Linux, Mac and Windows.
Example usage
$source = "/var/www/example.com"; $destination = "/var/backup/example.com"; try { $sync = new DirectorySync($source, $destination); $sync->exec(DirectorySync::COMPARE_FILEMTIME); } catch(SyncException $exception) { fwrite(STDERR, "Error performing sync: " . $exception->getMessage()); exit(1); } echo "Sync complete!" . PHP_EOL; echo "Changed: " . count($sync->getCopiedFilesList()); echo "Deleted: " . count($sync->getDeletedFilesList()); echo "Skipped: " . count($sync->getSkippedFilesList());
Features
- Cross-platform compatible directory synchronisation (Linux, Windows, Mac).
- Selective sync through glob matches (only sync js files within script directory with
/script/**/*.js). - Get statistics of copied/deleted/skipped files after sync execution.
- Low memory footprint.
统计信息
- 总下载量: 5.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2019-03-23