Page 1 of 1

Creating a unique temp folder for your files

Posted: Sat Dec 08, 2007 9:42 am
by Mistrel
This is a neat snippet that will help you find a unique directory for your temporary files. If a directory with the same name exists then it will be enumerated.

Don't forget to remove the folder and its contents when you close your program. :)

Code: Select all

tempdir.s=GetTemporaryDirectory()

Repeat
	dirname.s=tempdir.s+"foldername"+Str(i)
	If FileSize(dirname.s)=-1
		result=CreateDirectory(dirname.s)
		Debug dirname.s ; debug folder name
	EndIf
	i+1
Until result