I’ve been doing some backups and cleaning up my system and was struggling to figure out how to sync two folders on mac. so here you go I tried the tools that are out there all seamed to be crappy but there is an easier way.
There aren’t any really good tools out there to help sync mac folders between two local folders. I wish there was a cool fun interface but i’ve tried a couple of tools such as syncTwoFolders and it was just generating errors with a very unclear and odd UI. sorry i just didn’t dig it. all my searches online for syncing never found what i was actually looking for as the tools out there are just not good.
Somehow i feel only a site that was talking about a terminal way of doing it. i gave it a try and it worked so easy and great so i thought it would be worth mentioning it here.
There are many features in the Terminal command but no need to go to deep into it as the most common tasks would be to sync between two folders the one would be to replace older files without deleting files that are not in the origin while the other is to replace files and delete files that are not in the origin such as if you delete some of the files and don’t want them back. AS i know ill forget this command in a week and I’ll need it again I’m pasting it here and i hope others find use for it as well.
You will need to use terminal. Change the source folder and destination folders.
rsync -vur --exclude=*.db --exclude=*.info /sourceFolder /destinationFolder
Really nice and easy what this one does is only copy/update files it does not delete anything in the destination folder. If you want to delete as well missing files in the destination folder just add this into the code:
rsync -vur --delete --exclude=*.db --exclude=*.info /sourceFolder /destinationFolder
hope this helped you sync folders on Mac OS! I know it is helping me now.
If you need a step by step guide:
- In your Spot light type “terminal” enter terminal
- It doesn’t mater where it opens it just type :
- If there are files you want to exclude you can list them out (for example all your .svn files can be a good example) in our case we wanted to exclude 2 file types:
- If you want to delete the files in the destination you can add this code as well:
- Add the origin folder(the folder from witch you want to copy/sync) – the best way to do this is to drag the folder into terminal the folder path will output
- Add the destination folder path (same deal as before)
that’s about it take a look below for a full example (don’t forget to put the space where it needs to be and just be very careful not to delete something you didn’t intend to delete).
p.s a good tip to get your folder without writing the name is to drag the folder into terminal it will output the path of the folder for you.