how to create unique filename in a specified folder ???

  • Thread starter Thread starter Antonio Lopez Arredondo
  • Start date Start date
A

Antonio Lopez Arredondo

hi !

system.io.path.gettempfilename() returns a unique file name in the TEMP
folder.

does anybody know how to create a unique file name in another folder ?

thanks in advance,
ant.
 
Two ways:

You could create a GUID and ToString it, and use that as the file name.

You can call Kernel32.dll's GetTempFileName (That's what GetTempFileName
does, but it automatically uses Path.GetTempPath as the path). This'll
require P/Invoke.

-mike
MVP
 
Back
Top