Learning to Sync Two Directories With rsync On Command Line

On macOs-machines (and other unix-like systems most likely too) you can use rsync command to sync two directories in many different ways.

This post is just a quick reminder two myself for a specific use. See links below for further info!

Imagine you’ve copied some file structure to a new directory, have by accident lost some of the files during that process and further more started to working on the files in the new file structure.

You might have some issues if you want to copy the missing files from the old file structure to the new one without searching too long AND without erasing your new work in the new structure if you’d just repeated the copy process.

I used rsync as follows:

rsync -rP /my/old/directory/ /my/new/directory

-r Option: Recursive, traverse into subdirectories
-P Option: Equivalent to –partial –progress: Show progress during transfer
Note that you need to put a slash after your old directory. If not rsync will simply copy your old directory in the new one instead of searching through your old subdirectories for changes.

Ressources I’ve been using to learn this