Thursday, November 06, 2014

rsync


Synchronize directory trees incrementally (only newer files get pushed)

rsync -vazh ~/git/myproj --exclude 'node_modules/' --exclude '.git/' --exclude '.idea/' myser@dev01:~/git

-a: archive (preserve timestamps/permissions)
-v: verbose
-h: human-readable output
-z: compress
-u: only new(er) files
--exclude: self-explanatory. Be sure to list a separate instances for every excluded path

It is important to include the trailing slash in the source path. That instructs rsync to copy the content of that directory into the destination path. Omitting the trailing slash will create the referenced directory in the destination (e.g ~/git/myproject/src/src/)

No comments: