The filenames are created using a command line script that accepts parameters and builds the file. I need to keep the counter number somewhere else and not in the script itself.
If I dont lock the 'counter number holder file thingy' and two occurances of the cli access the 'counter number holder file thingy', each occurance of the script will get the same number.. hence the requirement to lock the 'counter number holder file thingy'.
I do agree though that I might need to look at a database.
Of all the things I've lost in my life, its my mind I miss the most.