in reply to What's the best way to avoid name collisions when creating files?
Might take a look at how qmail's maildir format handles a similar application.