in reply to Re: Automatically creating incremental file names
in thread Automatically creating incremental file names

Do you use this approach in a CGI script that is supposed to create files and not over-write/re-use existing file names (as the OP wants to do)?

If so, the first "customization" that would be needed is something like a separate semaphore file, to be locked before doing the "if (-e ...)" test, and released after leaving whichever block is executed as a result of that test. Otherwise, two competing processes on the same web server could still collide on the same file name.

(Another customization I'd want is to indent the code properly. But personally, I think the initial reply in this thread, suggesting a SHA1 signature as the file name, has the most merit.)

  • Comment on Re: Re: Automatically creating incremental file names