DEV Community

Fega Suseno
Fega Suseno

Posted on

Sync Folder Using Rsync

Hai,
Pada postingan ini akan membahsa tentang syncronize folder atau file dengan rsync.
Rsync adalah sebuah software yang digunakan untuk melakukan sinkronisasi dan transfer data antara sistem komputer yang berbeda. Singkatnya, rsync memungkinkan untuk menyalin, memindahkan, atau menyinkronkan file dan direktori dari satu lokasi ke lokasi lain melalui jaringan lokal atau melalui SSH (biznetgio.com)

Langsung ke cara pemakaianaya

rsync -arv source destination
Enter fullscreen mode Exit fullscreen mode

Atau bila ingin melihat partial dan progressnya bisa tambahkan berikut

rsync -arvP source destination
Enter fullscreen mode Exit fullscreen mode

Berikut beberapa contoh penggunaanya:

rsync -arvP -e 'ssh -p 123'  root@10.10.10.1:/root/simulasi/ run/
Enter fullscreen mode Exit fullscreen mode

Jika ingin mengexclude file atau folder

rsync -avre 'ssh -p 123' --progress --exclude="folder29" root@10.10.10.1:/root/simulasi Migrasi/run 
Enter fullscreen mode Exit fullscreen mode

Jika ingin mengexclude beberapa folder bisa seperti berikut

rsync -avrPe 'ssh -p 123' --exclude={'folder2','folder5','folder35'} root@10.10.10.1:/root/simulasi Migrasi/run
Enter fullscreen mode Exit fullscreen mode

semoga bermanfaat

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more