HI, I need to create unique folder name to be created in the user local App data path, I cannot generate folder names using MD5 and other algorithms as the result has in valid characters for folder name. Is there a way from which I can generate folder names from a given file path or name ?
A:
Why not just remove, replace or encode those invalid characters as valid ones?
David
2009-07-14 15:41:56
+7
A:
Can't you just use a Guid?
String folderName = Guid.NewGuid().ToString();
Simon P Stevens
2009-07-14 15:46:51
Even better, use `ToString("D")` to get rid of the hyphens.
LukeH
2009-07-14 15:55:48
A:
How fast are you willing to get those folders created ? I'm saying this because you could use the system time, in milliseconds, to name those unique folders. If you want to avoid the possibility of having two or more folders on the very same time, concatenate some string at the end.
nairdaen
2009-07-14 17:26:27