Playlist MyTV untuk smart TV berserta intisari rancangan bermula RM4.99 sebulan. Selanjutnya →

Sync files between computers

Rabu, 5 Ogos 2009, 12:00 pm0

There are many ways to sync files between computers: the usual copy-paste using removable media, or copying through FTP/SCP. But there’s a proper program to do the sync-ing: rsync.

If you’re using *NIX based operating system, rsync is usually installed as default. However, if you’re stuck with Winblows, there’s a way to use rsync, through Cygwin.

Cygwin installation is a no-brainer. Download the setup.exe from cygwin site, run it and just follow the instruction. Newbie might find it confusing to choose which mirror, but I usually choose ftp.jaist.ac.jp, and keep the root install directory at C:\cygwin.

Default cygwin installation doesn’t have rsync. Therefore, at the select packages page (during the installation), click on ‘View’ button to see list of programs available, sorted alphabetically. Find rsync & openssh package and click ‘Skip’ so that the program version number is shown (see screenshot below). Then, click Next to finish the installation – the installer will download the packages from the internet / repositories (mirror that you choose earlier), install them into the computer and finish the initial configuration automatically – so much like how Linux package manager (yum, apt-get, yast, emerge etc.) works.

Finish with cygwin installation, now let’s see how the magic works. To sync files on your Winblows machine to another computer (with IP address 192.168.1.100), here’s the command. Note that to refer drive C in Winblows, use /cygdrive/c.

rsync -ru /cygdrive/c/Users/Azwan/Pictures/Photos [email protected]:/home/azwan/Photos

Here’s the format of the command. Flag -r is for recursive option (it copies folders & files within the specified directory) and -u is for update (if files already at the destination, it won’t be copied over)

rsync [option]<source-directory><user>@<destination-host>:<destination-directory>

Make sure SSH is working on the destination machine. That’s all for now, sign out.

El-nino

11 Ogos 2009

Tulis komen: