use rsync to backup a directory
March 6th, 2006 by Lawrence David
if you’ve got access to a file server, rsync can be a godsend.
for instance, i use the following one-liner to synchronize my itunes music folder with my music server:
rsync -av –progress –size-only –delete –rsh=/usr/bin/ssh ~/Music/iTunes/iTunes\ Music/ user_name@server_address:~/Music/
this command copies all of the music in my laptop’s itunes directory to the ~/Music directory on the music server. what’s cool is that if i delete a song or album on my laptop, rsync will delete the corresponding file or directory on the music server.
this works of course on linux; mac users can also execute this command using the os x terminal.