in reply to What's the best way to avoid name collisions when creating files?

Thanks for all the excellent suggestions. Right now I'm using filenames of the format <unix time>.<pid>.<counter>. I'm opening the files in a loop with O_CREAT and O_EXCL and if the initial open fails I increment the counter and keep trying until it works. I think that will be more than adequate for my needs.
  • Comment on Re: What's the best way to avoid name collisions when creating files?

Replies are listed 'Best First'.
Re^2: What's the best way to avoid name collisions when creating files?
by suaveant (Parson) on May 04, 2005 at 14:25 UTC
    And it is nice to have useful info in the filename, I use date time pid for my maildir stuff and it lets me easily identify message dates and times... actually been useful a couple of times for things like spam stats.

                    - Ant
                    - Some of my best work - (1 2 3)