The easy tutorial of Rsync to “SYNC” two folders and its contents.

January 19th, 2019 admin Location: Raleigh, NC, Topic: Web Design | Digital Media

If you are looking for a solution to syncing two folders, whether it’s over a network or locally, this is how you do it.

In my opinion this is a very valuable specially when you have media files that are very important to you and you want to lose them.

The RSYNC command

The -a flag means “archive” which in turn means recursive and preserving symbolic links, ownership and permissions. In general, it is more likely to use -a than to use -r (recursive).

rsync -a sourceDir/ destinDir

The -n variable is meant as a test “dry-run” and so no actual changes are made. -v is Verbose.

rsync -anv sourceDir/ destinDir

The -z flag compresses the network transfer reducing the size of the transfer as much as possible. The -P flag combines –progress (progress bar) and –partial (to resume interrupted transfers).

rsync -azP sourceDir/ destinDir

The –delete flag deletes the files in the destination that have been removed in the source. Therefore keeping a true sync between both directories. Ideally run it with -nv flag first to make sure that is to be removed is what you want.

rsync --delete sourceDir/ destinDir

Summary

So in summary you want to use this to Sync two directories:

1. Run it as a test.

rsync -anv sourceDir/ destinationDir

2. Ready? Run it.

rsync -azPv sourceDir/ destinationDir

3. If the sync has been there before, and so now is truly about syncing the two directories then use:

rsync -azPv --delete sourceDir/ destinationDir

Note: If you use a slash at the end of the first directory, then it means: “The contents of sourceDirectory” but not the directory itself. On the other hand if you ommit the use of the slash in the sourceDirectory then it means: “The content of the sourceDirectory but also the SourceDirectory/ itself”.

Thanks again.

About the Author

Alex Centeno MBA., is an international creative director and digital media strategist. Currently residing minutes away from the Research Triangle Park (RTP) - North Carolina, and with over 10 years of interactive marketing training and experience, Alex leads Merkados' international clients to maximizing their online business strategies. One of Alex's biggest strengths is his world-class capacity to effectively combine interactive marketing, digital media design and web development.

You may find further information about Alex Centeno MBA. at: and Twitter.

Sobre el Autor

Alex Centeno MBA., Es un director creativo y estratega de medios digitales reconocido internacionalmente. En la actualidad reside a tan solo minutos del Research Triangle Park (RTP) - Carolina del Norte, y con más de 10 años de entrenamiento y experiencia en marketing interactivo, Alex lidera a los clientes internacionales de Merkados™ para maximizar sus estrategias de negocios en línea. Una de las mayores fortalezas de Alex es su capacidad global de combinar de manera efectiva, mercadeo interactivo, diseño de medios digitales y desarrollo web.

Para más información sobre Alex Centeno MBA. puede visitar: y Twitter.