rsync exclude option with file names with spaces

I have been trying to run rsync as follows;

rsync -av --exclude '/home/joe/VirtualBox*' /dst

where VirtualBox* denotes all files and directories under the directory 'VirtualBox VMs'

However, it does not appear how I specify this --exclude option, rsync tries to backup everything under the 'VirtualBox VMs' directory.

Tried using --exclude= , --exclude={ } but the result is the same.

Any ideas what I am doing wrong here?

2

1 Answer

The exclude option of rsync works on relative paths not absolute ones. So for your example something like the following will work:

rsync -avz --exclude 'directory' source_directory/ destination_directory/

In this generic example you can see that --exclude 'directory' assumes that directory is a sub-directory of source_directory.

I have included the -z option for the rsync line, compression gives a few small speed increases...

Notes:

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like