How to Fix the Error “The Action Can’t Be Completed Because the Folder or a File in it is Open in Another Program”
If you copy or move files or a folder from one location to another in File Explorer (formerly known as Windows Explorer), you may have seen the following error in Windows 7, 8, 8.1, or 10. I am going to use Windows 10 as an example in this article.
The action can’t be completed because the folder or a file in it is open in another program.
The title of the error message is Folder in Use, because I wasn’t able to move the wp-content folder. When you experience this error, you won’t be able to copy, move, or delete some or all of the files.
POSSIBLE SOLUTIONS
The solution depends on many different factors. Here are some possible solutions that can help you get rid of the error and copy, move, or delete a file or folder that just won’t let you take any action on it in Windows.
1. Close as Many Applications as Possible
You may not be able to close all the applications due to various reasons. If that’s the case, just close the ones you can and then try copying or moving the folder or file that was giving you an error.
2. Empty Recycle Bin
Go to the Recycle Bin and empty it. In the past, I have resorted to other solutions to solve the exact same problem. This is the solution that worked for me today. After you have emptied the Recycle Bin, try to copy or move the folder or file that was giving you an error.
3. Empty Temp Folder in AppData
In the Windows search box type %temp% and press Enter. You will be taken to the C:\Users\username\AppData\Local\Temp folder. Delete all the files in this folder. They may be interfering with the copying or moving of files because the information in a file may be cached here. Keep in mind, you won’t be able to delete all the files because some of them may be in use by certain applications. That’s okay, just close what you can and then try to copy or move the folder or file that was giving you an error.
4. Use Process Explorer
Microsoft’s Process Explorer can come handy if you are trying to locate the process that might be using the file or folder that you are unable to move. You can download the free Process Explorer utility here. You can also use the Task Manager in Windows, but think of Process Explorer as the Task Manager on steroids. Save yourself time and don’t waste time in Task Manager, just go straight to the Process Explorer. This tool has been around for a very long time. If you try to kill a task in Task Manager and are unsuccessful, that’s when Process Explorer can come to the rescue. You can do a search on the file that you are unable to move. Click the search button and type the name of your file that you can’t copy, move or delete. It’s helpful to Show Processes from All Users on the View tab. Look at the Process ID (PID) number in the PID column in the Search box and then locate it in the Process Explorer PID column.
In the above example, the PID number is 28752. Notice the line item in the Process Explorer that corresponds to it. Your preference should always be to close the process properly, such as closing the application, but sometimes the process may be hung or there might be an associated process that is hung. That’s when you can use the delete key on your keyboard to kill the process, or you can right-click and select Kill Process. When you right-click, you also have the ability to Kill Process Tree, which will also close any other associated processes. Now try to copy or move the folder or file that was giving you an error.
5. Don’t Forget the Preview Pane
This is an easy one to miss. Sometimes the file may not be open in an application, such as Word, PowerPoint, or Adobe Acrobat, but the file may be open in the Preview Pane in the File Explorer, which can prevent you from copying, moving, or deleting the folder or the file in another location.
Here’s an example of a PDF file open in the Preview Pane in Windows 10 File Explorer. You can toggle the Preview Pane on or off by clicking on it in the ribbon. Now try copying or moving the folder or file that was giving you an error.
6. Turn Off Thumbnail Caching
This solution can be useful when the issue is related to the thumbnails. Windows uses thumbnail cache to store the thumbnail images that are viewed in the File Explorer. It’s supposed to help you with the performance and speed things up when you are viewing lots of images in a folder. However, these thumbnails are known to cause a lot of issues. They have been around for a long time and in Windows Vista Microsoft decided to store all the cache in one location at %userprofile%\AppData\Local\Microsoft\Windows\Explorer.
Security Implications
From a security perspective, the cached thumbnails can be an issue. As a Forensic Investigator, I find these thumbnails to be a valuable tool in recovering information from deleted files because even if you delete the images, sometimes the cached files will still be there and can reveal the contents of the deleted images. There are ways to even link the thumbnails to their original files. That’s why you may want to turn off the thumbnail caching and then clean these thumbs.db files in environments where there are privacy and security concerns. If you have only one hard drive, you can easily delete the thumbs.db files on your entire hard drive. Go to the Command Prompt and make sure you are at the root of your drive C. If not, type cd\ to get to the C:\ prompt and then use the delete command as follows: del /ash /s thumbs.db This will delete the hidden thumbs.db files in all the subdirectories of drive C. If you have multiple drives and are not familiar how to automate the process, just contact me or comment on this article and I will share a script. CAUTION! Because the cache will be recreated, if you are concerned about privacy then you will have to delete these files on a regular basis. The drawback of deleting the cache is that your image files may be slower to display in File Explorer. However, depending on your environment, you may not notice much difference. If you don’t have any security or privacy concerns, then I would suggest you only delete the cache if you are troubleshooting or want to solve the issue I am addressing in this article. Remember, your cache will be rebuilt so you don’t have to worry about the performance. |
Now that you have a better understanding of what the thumbnails are and how they work, let me show you how you can turn off caching of thumbnail pictures by using the Local Group Policy. In a domain environment, you can use the Domain Group Policy to make this change on selected computers, as necessary.
- At the Start, Run type gpedit.msc, or type group policy in the Windows search box and select Edit group policy. Either way you are starting the Local Group Policy Editor.
- Go to User Configuration -> Administrative Templates -> Windows Components -> File Explorer. In earlier versions of Windows, the File Explorer was called Windows Explorer, so look for that folder if you are using an older version of Windows.
- Double-click the entry Turn off caching of thumbnail pictures, select Enabled, and then click OK.
- Start Command Prompt with Administrator privileges. If you are not sure how, type Command Prompt in Windows search box, then right-click Command Prompt and select Run as administrator.
- Type gpupdate /force and then press Enter. This will update the group policy right away, otherwise either you have to wait for the group policy to be refreshed or reboot the computer which will update both user and computer policies. Try copying or moving the folder or file that was giving you an error.
Turning off Thumbnails Display
If you are interested in turning off the display of thumbnails in File Explorer, go to the File Explorer ribbon and select the View tab -> Options -> Change folder and search options. In the Folder Options window click the View tab and clear the box Always show icons, never thumbnails. Click OK to apply the change.
7. Restart Your Computer
Restarting the computer will clear all the cache, close temporary files that were open in applications, close any processes that were lingering in the background or didn’t close properly, reset all the network connections, reset the drivers, clear the ARP cache, and clear the NetBIOS cache, so you are starting with a fairly clean slate. However, if the rebooting option is your first option, don’t be surprised if it doesn’t solve your problem because you may still have to use another method. For example, restarting the computer won’t clean your Recycle Bin and I mentioned that cleaning the Recycle Bin is one of the solutions I have listed and it happens to be the one that worked for me.
8. Refresh Your Desktop Icons
This last scenario is slightly different because this is not related to the File Explorer. This is related to the Windows desktop, but I thought I will throw this one in as a bonus tip. In this case you don’t get the error that the file or folder is open, you are just not able to delete the item.
It’s amazing how many times I have run into this situation where I am unable to delete a file or a folder on my desktop. Sometimes when the file or folder is deleted, Windows doesn’t refresh the screen so you keep on trying to delete an item, but you can’t because it doesn’t exist. If you simply right-click your desktop and select Refresh, the item will disappear from your screen, assuming it was deleted in the past. Keep this in mind if you are working with files that are on another computer, like a network file server, and even rebooting your computer won’t allow you to delete the item on the desktop. You would imagine that rebooting would have refreshed your screen and it should have disappeared, but that is not always the case. A lot has to do with thumbnail caching, which by the way are not used only for images, they are also used for Microsoft Office documents. When you are working with network files, Windows doesn’t use the local cache of the files, instead it creates thumbs.db files in the network folder where the images are stored. That’s one of the reasons why people are sometimes not able to rename or delete a network file in File Explorer, which can be very frustrating. The thumb.db files are notorious for preventing people from deleting network folders.
If you were able to solve this problem using a method that is not documented in this article, please share it with others by commenting on this article.
Thanks for reading my article. If you are interested in IT training & consulting services, please reach out to me. Visit ZubairAlexander.com for information on my professional background. |
Copyright © 2017 SeattlePro Enterprises, LLC. All rights reserved.
Thank you very much, using process explorer helped me like a miracle.
Wow, this is a really helpful list. For me, emptying the Recycle Bin did the trick this time, but I’m saving your entire list for future reference, thank you!
Deleting the temp file worked for me – thank you very much!
Very helpful thankyou. I’ve been using computers since the beginning. This problem didn’t used to occur. Then now and then. Now it happens ALL the time. I have found that the “take possession” function you can load on the right button works sometimes.
Thank you. Deleting the temp files fixed the File in use issue.
It’s interesting that different solutions are working for people…..using process explorer, emptying recycle bin, deleting the temp file, etc. I appreciate everyone’s comments.
As Tina mentioned, this was not a problem in the older operating systems. If I am not mistaken, this problem became apparent in Windows 7 and continued to be an issue in Windows 8 and now in Windows 10.
Deleting the temp file worked for me – thank you very much!
No 2 (Empty Recycle Bin) worked for me. Thank you very much.
Malk
Thanks, emptying the temp data folder helped!
In the past I had always managed to work around this problem but your help using Process Explorer worked like a charm. I wanted to post a big thank you for the help.
Thanks, Chris. Glad my article was helpful. I also want to thank you for reporting the issue with the captcha on my blog. I was able to fix the issue.
Wow! Thanks for the great tips. I used #4 Process Explorer to find the offending culprit.
What do I do when none of these things worked?
Jacob, if you are accessing files on a different computer (workstation or server), restart both the computers. If that doesn’t help, start Sysinternals Process Explorer and make a note of the PID (Process Identifier) for explorer.exe process. Right-click explorer.exe and restart the process. Confirm that the PID number changes to a different PID to ensure the process was restarted. Another thing to try is to disable all the applications on the Startup tab in the Task Manager, then restart the computer. If none of these tips help then contact Microsoft tech support.
Easiest solution
Go to task manager
Kill all explorer.exe processes
Click on action/run
Type in explorer
go to file to delete, and delete it
99.99999% of the time it is EXPLORER itself that is the cause of the problem, even though microsoft REFUSE to acknowledge it!
BRILLIANT
I have spent hours trying to delete an empty folder.
Downloaded Process Explorer found that Excel was hanging onto a file, even though it wasn’t showing, shut down Excel, job done, folder gone
It wasn’t in this guide, but my problem was that the folders I was trying to delete were being synced with google drive, so my computer was registering them as being in use. I simply stopped syncing them and the problem was solved.
Thanks.
The mere fact that this is even a thing goes to why Windows is the worst operating system in existence for Desktop computing. Precisely why I switched to a Mac a decade ago.
Interesting. Of all the suggestions above, the only one that worked for me was to close explorer from Mike on March 24, 2019 at 1:58 pm. I had problems renaming a folder and syncing it with OneDrive. Once I closed explorer, I used the command prompt from Task Manager, renamed the folder, started up explorer again and it was all fine.
Very strange indeed.
Thanks bro. It Worked for me.
I uninstalled a program and a file was previously open in it. So when I tried renaming that file I couldn’t. To my surprise that program was somehow still running even after uninstalling and the task manager wouldn’t show it. Fortunately Process Explorer worked.
Thanks for this. ☺❤
Process Explorer is a God-send!! Thank you for the heads up about it!
The process explorer option was really useful,
Thanks.
Many thanks for the tips. Process Explorer is really powerful.
Thanks for sharing 🙂
Thank you, saved the day! Just removing the temp files helped!
Using process explorer worked and it was actually windows explorer itself I had to kill & restart. Thank you!
One more thing you should know before trying all these other solutions – OneDrive will also throw this error if you are trying to access a file where the folder pathname is more than 256 characters. Check your folder structure first and if it seems really, really long then rename the parent folder to something shorter.
Eg: I’ve seen customers get this error when the folder the file is in is named something like:
“My Projects and important files\Projects for company ACME\My Projects\Projects for the year 2022\Projects for January 2022\Important notes and files\Meeting agendas and minutes for Projects in 2022\Word documents and scanned files\My file name is JUST WAY TOO LONG and OneDrive doesn’t know what to do with it.PDF”
Remove any shares to folders if you are trying to delete folders.