Can't get rsync exclude to work correctly
by MALDATA from LinuxQuestions.org on (#4T0SC)
Hi all,
This has been bothering me for a while, and I can't figure out where the problem is. I use ssh & rsync to do remote backups. On the machine I'm backing up, there is a "VirtualBox VMs" directory that is huge and doesn't need to be backed up. I also don't need to back up all the hidden directories in home. So, I run
Code:rsync -avSXe "ssh -p <port>" --delete --exclude=".*/" --exclude="VirtualBox\ VMs/" host:/home/user/ /home/user/backupThis correctly excludes all hidden directories, but it still rsyncs the VM directory. I've tried all different kinds of syntax, for example,
Code:rsync -avSXe "ssh -p <port>" --delete --exclude=".*/" --exclude={"VirtualBox\ VMs/"} host:/home/user/ /home/user/backupCode:rsync -avSXe "ssh -p <port>" --delete --exclude={".*/","VirtualBox\ VMs/"} host:/home/user/ /home/user/backupCode:rsync -avSXe "ssh -p <port>" --delete --exclude=".*/" --exclude={"VirtualBox\ VMs/"} host:/home/user/ /home/user/backupCode:rsync -avSXe "ssh -p <port>" --delete --exclude=".*/" --exclude="VirtualBox*/" host:/home/user/ /home/user/backupAnd so on. None of them have worked. It rsyncs the VM directory every time. What am I missing? Thanks!


This has been bothering me for a while, and I can't figure out where the problem is. I use ssh & rsync to do remote backups. On the machine I'm backing up, there is a "VirtualBox VMs" directory that is huge and doesn't need to be backed up. I also don't need to back up all the hidden directories in home. So, I run
Code:rsync -avSXe "ssh -p <port>" --delete --exclude=".*/" --exclude="VirtualBox\ VMs/" host:/home/user/ /home/user/backupThis correctly excludes all hidden directories, but it still rsyncs the VM directory. I've tried all different kinds of syntax, for example,
Code:rsync -avSXe "ssh -p <port>" --delete --exclude=".*/" --exclude={"VirtualBox\ VMs/"} host:/home/user/ /home/user/backupCode:rsync -avSXe "ssh -p <port>" --delete --exclude={".*/","VirtualBox\ VMs/"} host:/home/user/ /home/user/backupCode:rsync -avSXe "ssh -p <port>" --delete --exclude=".*/" --exclude={"VirtualBox\ VMs/"} host:/home/user/ /home/user/backupCode:rsync -avSXe "ssh -p <port>" --delete --exclude=".*/" --exclude="VirtualBox*/" host:/home/user/ /home/user/backupAnd so on. None of them have worked. It rsyncs the VM directory every time. What am I missing? Thanks!