When creating a temp file System.IO.IOException: The file exists error

http://blog.dileno.com/archive/201103/fixing-the-file-exists-ioexception-error/

If you get the System.IO.IOException: The file exists error, it’s probably because your C:/Windows/Temp folder is absolutely full with temporary files. In fact, if you have more than 65535 files in your temp folder, the method GetTempFileName will throw this error.

To resolve this, just remove all temporary files in C:/Windows/Temp. It might take some time, but it will solve the problem.

Here’s the stack trace I got:

System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   System.IO.Path.GetTempFileName()

 

5 comments

  1. Run into this problem in Subtitle Edit. Have a bit of stack trace knowledge from Java so copying the topmost error message led me here.

    This trick made it go away so thank you.

  2. If you are running this command under a specific user you could check also the temp direcotry of your user profile usually in c:\Users\AppData\Local\Temp

Leave a reply to Dave Friedel Cancel reply