Excluding Multiple Folders using rSync

I’ve started to test out the VMWare vCloud Air Object Storage (VCAOS – Sorry!!)

Currently there’s no option for a GUI so I’m having to use GSUTIL to upload data. I make no secret of my dislike for CLI’s – I have no real reason to dislike them other than I’m terrible at using them.

Anyway I want to make a backup of my laptop to VCAOS/Google Object Storage but there are some folders I don’t want to upload. I spent ages trying to find a decent guide but struggled so I made this post.

I want to upload all the files and folders in “Documents” on my Mac to my Goggle Object Storage

To copy everything I would use the following command –

gsutil rsync -r /Users/richhimself/Documents/Test_Sync gs://sillycloudname/Documents/

However I don’t to copy two folders called “VHDs” and “Downloads” so I here’s how I would do it.

gsutil rsync -r -x ‘VHDs/|Downloads/’ /Users/richhimself/Documents/Test_Sync gs://sillycloudname/Documents/

I also realise I’ve got lots of random .iso files in my Documents folder so I also want to exclude these

gsutil rsync -r -x ‘VHDs/|Downloads/|.iso’ /Users/richhimself/Documents/Test_Sync gs://sillycloudname/Documents/

You can obviously make your own scripts up to schedule this etc.

Leave a Reply

Your email address will not be published. Required fields are marked *