On Fri, Feb 06, 2015 at 07:58:22PM +0000, Curtis Vaughan wrote: > I need to rsync several, but not all, the Maildir directories under /home. > I have a file with all the user accounts, so what would the script be to > say take each user account name and then rsync up each Maildir directory. > > The rsync command would be: > > rsync -arv ./[username]/Maildir/ root@[computer]:/home/[username]/Maildir/ > > I have already gone through each user's directory and manually done each > one over the course of the week. Now I want to be able to sink up using a > single command. > I think you want to use rsync's --include-from parameter. That lets you specify a file which contains all the includes. I don't think you need a catch-all --exclude=* after that, but I'm not 100% sure. Take a look at the FILTER RULES section of 'man rsync'.
It would be something like: rsync -arv --include-from=my_include_file ./*/Maildir/ root@[computer]:/home/*/Maildir/ and my_include_file would be something like: user1/Maildir/ user2/Maildir/ user5/Maildir/ I think you want to specify 'Maildir' after each user. Otherwise you might end up including a directory named 'user1' which resides in user3's directory. In other words, be as specific as possible with your includes. I haven't tested any of this. Just going from memory. -Rob
signature.asc
Description: Digital signature