How many times does it happen that we receive an error message when we want to delete a file or folder? Often the error message reads:
The action cannot be completed because the folder is open in another program
Let’s see how to figure out which process blocks the resource to be deleted
We use resource monitoring
Resource Monitor is present as far back as Windows 7 to Windows 10, to start it and check the status of the system proceed sat as follows:

- press the WIN-R buttons
- type “resmon” and give
- Select the CPU entry
- now in the search bar inherent in the Associated Handles type the folder or file that we are trying to delete
- Once we find the handle that locks the resource we can right-click and choose End Process
We use Process Explorer
Another powerful tool that can help us is Process Explorer, from Microsoft’s Sysinternal suite.
You can download it and start it directly live from the sysinternal site, obviously with administrative credentials.

Next, click Find > Find Handle or DLL, now specify the name of the file to search for or the path to the locked folder. On the results found we could interact with the right button and choose whether to end them.
We use Powershell
You can also use a powershell tool to check what’s blocking the file or folder.

After downloading and extracting it, just type:
Import-Module C:-Scripts-FindLockingProcess.psm1
Then type:
FindLockingProcess -FileOrFolderPath “C:-test.xlsx”
To have a complete list of available commands, type:
Get-Help FindLockingProcess –Full
Now we should be able to delete the file or folder. If you have any other suggestions, please write them down in the comments.