Skip to content

Instantly share code, notes, and snippets.

@loinguyenduc101
Created February 27, 2018 04:41
Show Gist options
  • Save loinguyenduc101/23d41e771d94e69f9ee52e4de3aa020a to your computer and use it in GitHub Desktop.
Save loinguyenduc101/23d41e771d94e69f9ee52e4de3aa020a to your computer and use it in GitHub Desktop.
sync two dir on local or remote
To sync the contents of dir1 to dir2 on the same system, type:
rsync -av --progress --delete dir1/ dir2
-a, --archive
        archive mode
--delete
        delete extraneous files from dest dirs
-v, --verbose
        Verbose mode (increase verbosity)
--progress
        show progress during transfer
                        — from rsync(1)
Note : The / after dir1 is necessary to mean "the contents of dir1". Without the trailing slash, would place dir1, including the directory, within dir2. This would create a hierarchy that looks like:
…/dir2/dir1/[files]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment