I am backing up most of an entire volume with rsync, wanting to omit the OS X overhead files and most of the files associated with a bunch of virtual machines.
Omitting the overhead files works. It's the VM files that I am having trouble with.
All of the VMs are located in a directory tree that starts at /VirtualMachines/. The VMs are located at the top level and in various levels of sub-directories. I want to keep just the VM configuration files (.vmx, .vmxf, and .plist), and skip the rest of the files (virtual disks, etc.)
So far I have been unable to get this to work. I have seen three outcomes:
- I get all VM files
- I get no VM files
- I get the files I want but only from the top-level
This is my current script:
#!/usr/bin/env bash rsync \ -vv \ --dry-run \ --stats \ --human-readable \ --archive \ --acls \ --executability \ --owner \ --group \ --hard-links \ --numeric-ids \ --perms \ --xattrs \ --filter="exclude /.DocumentRevisions*" \ --filter="exclude .DS_Store" \ --filter="exclude /.fseventsd" \ --filter="exclude /.Spotlight*" \ --filter="exclude /.TemporaryItems" \ --filter="exclude /.Trash*" \ --filter="exclude /.VolumeIcon*" \ --filter="exclude /.disk_label*" \ --filter="include /VirtualMachines/**.vmx" \ --filter="include /VirtualMachines/**.vmxf" \ --filter="include /VirtualMachines/**.plist" \ --filter="exclude /VirtualMachines" \ /Volumes/Data02/ /Volumes/Data03/Backups/Rsync/dpconsulting.dpc/Data02
It returns none of the VM files.
It is my understanding that rsync uses the first rule that matches so the includes should take precedence over the final exclude.
I'm obviously misunderstanding something, but re-reading the rsync docs and and reading lots of google results has not provided any clarification.
What have I missed?