[ILUG] Script to move Maildir content

Rory Browne rbmlist at gmail.com
Mon Jul 6 23:31:09 IST 2009


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