How to generate a unique file name similar as that created by CreateTemporary
If it is merely about creating something unique, why don't you use the current time to build a readable file-name which is unique?
DateString[{"file", "Year", "-", "MonthNameShort",
"Day", "-", "Hour24", "Minute", "Second", ".txt"}]
(* "file2014-May13-013029.txt" *)
Since it contains the time it will be unique (in this case up to the second). When you create many files and additionally, do it in parallel, you can add a counter and the kernel id. This lets you identify the kernel which created the name and it makes the files unique in one run. When you start it again, the time will be different and the counter can start over.
ParallelEvaluate[i = 0];
ParallelTable[
DateString[{ToString@$KernelID, "Year", "-", "MonthNameShort", "Day",
"-", "Hour24", "Minute", "Second", "-", IntegerString[i++, 16, 5],
".txt"}], {10}]
(* {"82014-May13-015507-00000.txt", \
"82014-May13-015507-00001.txt", "72014-May13-015507-00000.txt", \
"72014-May13-015507-00001.txt", "62014-May13-015507-00000.txt", \
"52014-May13-015507-00000.txt", "42014-May13-015507-00000.txt", \
"32014-May13-015507-00000.txt", "22014-May13-015507-00000.txt", \
"12014-May13-015507-00000.txt"} *)
I tested this with 10^5 file-names and all were unique.
Version 10.0 introduced CreateUUID
CreateUUID[]
(* "1aaeab6f-ad51-48d2-a939-366da47374a3" *)
The documentation says that
CreateUUID[] gives a UUID based on a 128-bit number, formatted as 32 hexadecimal digits grouped in the format 8-4-4-4-12.
CreateUUID[] makes use of detailed local system and session information, as well as absolute time.
Some Wolfram System features depend on assuming the UUIDs will not collide.
Just for fun I tested this with 100.000 UUIDs
Table[CreateUUID[], 100000] // Apply@UnsameQ
(* True *)
Rather ugly but should work
Block[{m},
While[FileExistsQ[
m = FileNameJoin[{Directory[], FromCharacterCode[RandomInteger[25, 35] + 97]}]]];
m]