26 February 2011

Small utility

Recently I re-open rsync for myself. I heard many people found it useful, but never used before. And its actually help me save some time.


Couple words on pathogenesis. Periodic need to sync sources with remote location could be tedious and annoying. Especially if you need to do it in hurry and destination OS is incompatible by nature. (For instance, WindowZ.) The SCM, actually, is a way there, but... if you really wants commit these changes, yes?

You still can pack / unpack bundles and easily copy it over network. Fortunately *NIX (Ok, at least MacOS, but I pretty sure Ubuntu does the same.) supports funny SMBs and there are lot handy tools that makes this task much easier. However there are only few files you need to copy, but have to pack tones of them.

So now we come to rsync. Its ideally fits my need so I even added it to my aliases:

alias mount-work='mount_smbfs //username@host/C\$/projects'
alias src-sync="rsync -Cavz --delete --exclude 'target' --include 'core'"

The "C" option is key there. It suppress all that crap metadata, specific for SCM like CVS or SVN and saves copy time if you do not need it. You can also specify pattern to exclude, as in my case - target, the default Maven's build directory.

So far, sync become very quick and easier.

No comments: