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.
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.
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.