Skip to content

Instantly share code, notes, and snippets.

@erikgall
Last active June 29, 2024 18:46
Show Gist options
  • Save erikgall/10102d57dff76149addb47f332535725 to your computer and use it in GitHub Desktop.
Save erikgall/10102d57dff76149addb47f332535725 to your computer and use it in GitHub Desktop.
Sync a local folder with a remote folder over SSH using rsync

The command -- rsync

rsync

rsync **source/** **destination

The source path must have a trailing slash to signify the end of the source directory path

Options

  • -a = all or recursive (sync all files in the directory).
  • -z = Reduce network transfer by adding compressing option.
  • -P = Combines the flags --progress & --partial (--progress gives you a progress bar, --partial allows you to resume partially/interupted transfers).

Sync a local folder to remote over SSH

[/directory/on/my/computer] ---> [/directory/on/server]

rsync -azP /Users/{username}/code/images/ [email protected]:/home/forge/mydirectory/storage/app/public
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment