Synchronize a project directory to a remote host using
rsync and validate changes safely with a dry run.
Use bidirectional workflows to keep backups current and to
restore updates back to the source when needed.
You are backing up a local project directory to a remote
server. Your job is to push project_files/ to a
remote backup location, preview changes before syncing, and
then pull updates from the remote backup back into your local
directory to simulate a restore or a mirrored workflow.
rsync is a default tool for backups and safe
deployments because it is incremental and can preview its
actions. In production, dry runs help prevent accidental
overwrites and give you audit-friendly evidence of what will
change.
project_files/ to a
remote backup path.
rsync -a for archive-mode sync (preserves
metadata and copies recursively).
-z for remote syncs.
-n (dry run) before
applying updates.
project_files/ to the remote backup path.
rsync -avz project_files student@remote.server.com:/home/student/backup/
-a enables archive mode, -v prints
what is being transferred, and -z compresses
data over the network. This is a typical “push backup”
pattern for a project directory.
sending incremental file list
project_files/
project_files/index.html
project_files/config.yaml
sent 2,048 bytes received 64 bytes 4,224.00 bytes/sec
total size is 1,984 speedup is 0.92
rsync -avzn project_files student@remote.server.com:/home/student/backup/
The -n option (dry run) shows what would
change. This is where you catch mistakes in source/dest
paths before overwriting files on the remote side.
(DRY RUN) sending incremental file list
project_files/new_file.txt
(DRY RUN) total size is 512 speedup is 1.00
rsync -avz student@remote.server.com:/home/student/backup/ project_files
This “pull” pattern is common during restores or when synchronizing from a canonical remote copy. Ensure you target the correct destination directory to avoid mixing contents into the wrong path.
receiving incremental file list
project_files/new_file.txt
sent 128 bytes received 2,048 bytes 4,352.00 bytes/sec
total size is 512 speedup is 0.94
rsync -a
: Archive mode (recursive copy + preserves permissions,
timestamps, and other metadata).
-v
: Verbose output (shows what rsync is transferring).
-z
: Compress file data during the transfer (helpful for remote
links).
-n
: Dry run (preview what would change without copying).
user@host:/path/
: Remote destination syntax when using rsync over SSH
transport.
/. Be explicit and verify
with a dry run when it matters.