Finding every email address in your IMAP folder

I recently had the pleasure of extracting every email address in a Dovecot IMAP folder on my Ubuntu server. Bash is killing me with how to escape files from this find:

find . -type d -name cur

I tried everything I found by googling, but I couldn’t get it. I didn’t have only whitespaces, but ampersands and other funny characters some people name their email folders with. I guess I’m not the bash power user I should be.

So, Ruby it is:


, , ,