UPDATE: Sometimes all you need to do is right click the OneDrive icon in the taskbar and disable it for a little while to transfer or delete files. Set the time desired and you can always re-enable it when the operations are complete. There are still times when explorer is the culprit.
I was trying to tidy up my folders in OneDrive locally and what a headache that turned out to be. There were some articles that, although they didn’t have a solution, they pointed me in the right direction but, until I figured out a workaround I kept getting, “The action can’t be completed because the folder or a file in it is open in another program, Close the folder or file and try again.” Sheesh!
I did figure out a way to move the folders and files but the solution to do so isn’t for beginners. However, if your at your wits end you might try this. It was the only one that worked for me. I’ll try to make this as simple to follow as I can. Follow the process and make sure to kill the correct explorer.exe or it won’t work. No guarantees either!
Run Explorer.exe
First, run explorer from the taskbar, start menu, or the search dialog in the taskbar. Type explorer.exe into the search as pictured.
Go To View / Options
Click on the upper tab titled “View”, and select “Options” on the right side.
Launch Folder Windows in a Separate Process
Click on the view tab again and scroll to the middle, put a check in the box next to “Launch Folder Windows in Separate Process”, and click “OK”.
Run Task Manager
Run the task manager the same way we ran explorer.exe, from the search dialog in the taskbar. In the lower left-hand corner of the task manager, click on “More details”.
Kill “Windows Explorer” Under Windows Processes
Now for the dirty work. There will be two instances of “Windows Explorer” visible in the task manager now, if you have the same exact reason for the error that I did. One at the top under “Apps”, and one at the bottom under “Windows Processes”. Make sure you’ve selected the correct one which is the one at the bottom of the list, in the “Windows Processes” section. When you’ve highlighted it by clicking on it, press the delete key once and it will stop the process. The taskbar at the bottom of the screen will disappear. The Windows Explorer instance at the top should still be running.
DON’T CLOSE THE TASK MANAGER!
Be sure to leave the task manager running because we’ll use it later to relaunch the explorer.exe executable for running the Windows shell.
Move Your Data
Now you can return to the Windows Explorer that is still open and move your folders or files. Hopefully it let you. Now to restore your settings.
Uncheck, Launch Folder Windows in a Separate Process
In the same Windows Explorer, click on the “View” tab, “Options” at the right, and remove the checkmark from “Launch Folder Windows in a Separate Process”. Click “OK”.
Restart the Windows Shell
Now go back to the task manager and from the menu at the top left, select “File” and “Run new task”. Type “explorer.exe” into the run line and press enter or click “OK”.
That should restart the shell and the taskbar at the bottom should now be visible.
Rebooting is easier, but if something keeps locking the file, then this is the solution.
You’re done, hope it worked for you too.
Thanks much. Works like a charm.