[ILUG] Script to move Maildir content
Rory Browne
rbmlist at gmail.com
Mon Jul 6 23:34:11 IST 2009
You might have trouble ssh-ing 60GB ( particularly if the servers
aren't beside each other ) , so it might be worth considering either
splitting the users up by first-letter-of-username, or creating a cpio
archive locally, and copy it to remote, and extract it in separate
steps. That way if one step fails, you only have to repeat that one
step. I'll talk more about that when I get some sleep in.
2009/7/6 Rory Browne <rbmlist at gmail.com>:
> I haven't read very deep into what you've said, but I'm going to take
> a leap of faith, and pretty much fundamentally disagree with everyone
> here ( except perhaps Paul Murray ).
>
> I don't think you should bring this to a bash-specific group, unless
> you're already involved with such a group. I don't think you should
> write it in anything else ( except perhaps ksh, or perhaps tcl, but
> that would be only if you know them better than bash ).
>
> I would need to examine your problem a bit closer, but I think if you
> have a good look through the manuals for find and cpio, you will get
> yourself 90% of the way there.
>
>
> I think you're loking for something along the lines of
>
> [oldserver]$ find /location/of/old/maildirs/*/.maildir/{cur,.*}
> -exclude .Trash | cpio -o | ssh newserver 'cpio -i '
>
> I believe cpio has an option for string substitution that you could
> use to change /old/maildirs to /new/maildirs ( or you could just
> create a temporary symlink structure to simulate the old environment
> ). I'd need to check the man page for find - I don't think the exclude
> option is just -exclude ( if you can't find it, just use grep ) as in
> ( find ... | grep -vf .Trash | cpio )
>
More information about the ILUG
mailing list