Rex::C...s::Sync(3pm)
β¨ Rex::Commands::Sync β the Rex::C...s::Sync(3pm) page, but make it cute β¨
Okay bestie, you found the docs for Rex::Commands::Sync β it's part of the User Contributed Perl Documentation and it's literally the "move my whole folder over there" module. Let's get into it. π¦
π NAME π
Rex::Commands::Sync β sync directories. That's the whole job. That's the vibe. π
πΈ DESCRIPTION πΈ
So here's the tea: this module can sync directories between your Rex system and your servers without needing rsync at all. No rsync install, no rsync drama, no rsync situationship. It just does the thing. π
β¨ SYNOPSIS β¨
Here's how the girlies use it:
use Rex::Commands::Sync;
task "prepare", "mysystem01", sub {
# upload directory recursively to remote system.
sync_up "/local/directory", "/remote/directory";
sync_up "/local/directory", "/remote/directory", {
# setting custom file permissions for every file
files => {
owner => "foo",
group => "bar",
mode => 600,
},
# setting custom directory permissions for every directory
directories => {
owner => "foo",
group => "bar",
mode => 700,
},
exclude => [ '*.tmp' ],
parse_templates => TRUE|FALSE,
on_change => sub {
my (@files_changed) = @_;
},
};
# download a directory recursively from the remote system to the local machine
sync_down "/remote/directory", "/local/directory";
};
Let's break down what's happening in that little masterpiece, because every single piece of it matters:
sync_up "/local/directory", "/remote/directory";β uploads a directory recursively to the remote system. Local β remote, up and away. πsync_up "/local/directory", "/remote/directory", { ... };β the deluxe version. Local β remote again, but now you're passing a hashref of options, and here's what can live inside it:filesβ if you want custom file permissions applied to every file, you put them here. In the example:owner => "foo",group => "bar",mode => 600. πdirectoriesβ same energy, but for every directory instead. In the example:owner => "foo",group => "bar",mode => 700. πexcludeβ a list of stuff to leave behind. Example:exclude => [ '*.tmp' ]. Bye to the temp files, we don't know them. πparse_templatesβTRUE|FALSE, exactly like that. Templates: parsed or not parsed, your call bestie.on_changeβ a callback sub. It gets called withmy (@files_changed) = @_;so you can see what actually changed. Obsessed with a module that tells you what it did. π
sync_down "/remote/directory", "/local/directory";β downloads a directory recursively from the remote system to your local machine. Remote β local, the other direction, still iconic. π§
Heads up:TRUE|FALSEand the{ ... }option hashref are written exactly like that in the docs, so keep them exactly like that in your code. No cap.
π«Ά a lil sign-off π«Ά
That's the whole page, bestie β no OPTIONS section, no SEE ALSO, no extra lore hiding at the bottom. Just a clean little sync module doing its main character thing. β¨
This page came to you from User Contributed Perl Documentation, generated with perl v5.40.1, dated 2025-10-03. Go forth and sync. πππ
π¦ where this page comes from
- ubuntu resolute: rex 1.16.1-1 Β· Apache-2.0
- ubuntu stonking: rex 1.16.1-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms