PeterBushMan Posted June 1, 2021 Share Posted June 1, 2021 Why I cant delete files in temp folder - window 10? C:\Users\user_name\AppData\Local\Temp Do someany have the same problem? Link to comment Share on other sites More sharing options...
Sensei Posted June 1, 2021 Share Posted June 1, 2021 If file is at the moment opened by some application or operating system, it cannot be deleted. Files can be opened in read, write or read-write mode. Files can be opened in shared or exclusive mode. Exclusive mode means no other process can access (open) file. Process holds handle to the file. You can learn which file is accessed by which process using FileMon or SysInternals. https://docs.microsoft.com/en-us/sysinternals/ If DLL (dynamic-link library) is opened by LoadLibrary() function it can't be deleted, until the all processes call FreeLibrary() or shutdown. DLL doesn't have to have .dll extension. Link to comment Share on other sites More sharing options...
MigL Posted June 1, 2021 Share Posted June 1, 2021 Download the free version of Ccleaner. Download CCleaner | Clean, optimize & tune up your PC, free! and let it do the clean-up. Link to comment Share on other sites More sharing options...
StringJunky Posted June 1, 2021 Share Posted June 1, 2021 (edited) 2 hours ago, MigL said: Download the free version of Ccleaner. Download CCleaner | Clean, optimize & tune up your PC, free! and let it do the clean-up. @PeterBushMan. Don't use the registry cleaner. app in it It can cause problems by erroneously removing registry keys that are still needed. Edited June 1, 2021 by StringJunky Link to comment Share on other sites More sharing options...
MigL Posted June 1, 2021 Share Posted June 1, 2021 I've been using the free version of Ccleaner for almost 15 years ( introduced in 04, I believe ). I run the system cleaner every time I shut down one of my computers ( about 18, all Win10, except for one Raspbian running RetroPi for old games emulation ), mostly to clean out cookies, and never had an issue. I run the registry cleaner ( all boxes checked ) every time I install/uninstall software, or MS updates me, and again, I've never had an issue. Link to comment Share on other sites More sharing options...
PeterBushMan Posted June 5, 2021 Author Share Posted June 5, 2021 On 6/1/2021 at 7:19 PM, Sensei said: If file is at the moment opened by some application or operating system, it cannot be deleted. Files can be opened in read, write or read-write mode. Files can be opened in shared or exclusive mode. Exclusive mode means no other process can access (open) file. Process holds handle to the file. You can learn which file is accessed by which process using FileMon or SysInternals. https://docs.microsoft.com/en-us/sysinternals/ If DLL (dynamic-link library) is opened by LoadLibrary() function it can't be deleted, until the all processes call FreeLibrary() or shutdown. DLL doesn't have to have .dll extension. The problem is that there are over 100 files in the folder - C:\Users\user_name\AppData\Local\Temp I can only delete a few of them. Window 7 did not have the problem. all files in any TEMP folders will be deleted by one click. Link to comment Share on other sites More sharing options...
Sensei Posted June 5, 2021 Share Posted June 5, 2021 (edited) 1 hour ago, PeterBushMan said: The problem is that there are over 100 files in the folder - C:\Users\user_name\AppData\Local\Temp I can only delete a few of them. Window 7 did not have the problem. all files in any TEMP folders will be deleted by one click. I have Win7 and also can't delete some files in temp directory. It is normal. Any application can create (and keep access lock to) temporary files by using GetTempPath()/GetTempFileName() functions: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppatha https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamea Reread what I wrote in the previous post and identify which processes opened these files. And kill these processes/services. If process/service is shutdown, it should release exclusive access lock to temporary file. The real problem would be if files would be really big. *) You can try: edit environment variables e.g. change TEMP and TMP from default value: %USERPROFILE%\AppData\Local\Temp to something else. e.g. change to Temp2. Then restart the computer. Then you should be able to delete old Temp folder with the all contents (because it is no longer used). New temporary files should appear in Temp2 folder instead. Then rename environment variables back to the original value, and restart the computer once again. *) They can be e.g. automatic updates downloaded from the Internet. Edited June 5, 2021 by Sensei Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now