I have been trying to run rsync as follows;
rsync -av --exclude '/home/joe/VirtualBox*' /dstwhere 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?
21 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:
- How to Exclude Files and Directories with Rsync: The page that got me to finally understand the
--excludeoption of rsync :)