0

We have a Windows Server 2008 machine running as a web server.

We noticed a problem with one of our PHP based websites today, and the error message related to the session and access to the Windows Temp folder.

When I logged into the server and tried to open the Temp folder in explorer it was taking a very long time. The files count was going up and up, and I closed it when it reached 220,000 files (and was still counting).

I tried to use CMD, but that hung when I did cd temp, so presumably it was counting files too.

So... I need a way to delete the entire contents of the Windows Temp folder, without having to open the folder up first.

I've installed disk cleanup, but that's just sitting there trying to calculate the space, so I guess it's counting files too.

I'm guessing that event viewer has something to do with this problem, because I can't open it (it's just sitting there saying "adding snap-in to console").

I've found the following: del %TEMP%\*.* /f /s /q ...which I could add to a .bat file.

Is that ok to try..? Or is there a better way..?

Stephen Last
  • 147
  • 2
  • 8

1 Answers1

1

Even that command will list the content. If you can wait do it, else boot in the repair console and do a RD / RMDIR on the folder and do a mkdir after. Too bad you cant do it while windows is loaded

yagmoth555
  • 16,758
  • 4
  • 29
  • 50
  • I guess I can wait, the server is still serving our other websites ok... I'm worried about what's adding so many temp files though. Is it possible that something is adding temp files faster than that `del` line can delete them..? – Stephen Last Dec 04 '14 at 11:45
  • 1
    When the del will start, we will see, as new file created while the del was run will be there. We can run a processmonitor with a filter for the folder, we will see what happen too. – yagmoth555 Dec 04 '14 at 11:55
  • It's running now... Looks like there are hundreds of thousands of `sess_` PHP session files in the temp folder. Guess I'll just leave it going and check again tomorrow. So I now need a solution to stop PHP leaving temp files around. – Stephen Last Dec 04 '14 at 13:31