Rename a folder when Windows claims it’s shared or open in another program

You’re trying to rename (or delete) a folder on your Windows 7 machine, and you get an annoying message saying that some of its subfolders are shared, or the message: “this action can’t be completed because the folder or a file in it is open in another program”. Possible quick solutions for the sharing error message:
  • Make sure it’s indeed not shared! (go to Properties->Sharing and make sure it says “Not Shared”).
  • Not sure which of the subfolders is being shared? Run net share to view all current shares in your machine (and thank me later). More documentation is here.
  • It’s sometimes the thumbs.db’s fault. It sometimes helps to change the “view” to disable any previews (e.g. use the “Details” or “List” views).
Possible quick solutions for the “open in another program” error message:
  • Delete all contents from “C:\Users\USERNAME\AppData\Local\Temp” (or simply type “%temp%” in your Windows Explorer or “Start” input box and it will get you there). If this doesn’t help, empty the Recycle Bin as well.
  • Restart the explorer.exe service (e.g. go to Windows Task Manager (CTRL+SHIFT+ESC), find explorer.exe and “End Process”, then under “File” click “New Task (Run…)” and type in “explorer.exe”)
  • Delete all thumbs.db files from that folder (search for thumbs.db and delete all results; don’t worry, Windows will generate them the next time you visit the appropriate files/directories). Also from Recycle Bin.
  • Update to the most recent .NET Framework.
  • Try to rename oldDirName newDirName from the Command Console (preferably with Administrator privileges, but doesn’t really matter in this case). If the command fails (“access denied”), run it in Safe Mode or immediately after the computer boots! (if the latter suggestion worked, this means that the culprit was some nasty service you have there running, better get acquainted with your processes, check out the cool Process Explorer by Windows Sysinternals.
Other possible solutions:

Related issue — remove an annoying “lock sign” off a file or a folder:

  • Compare the Properties->Security of that folder with another well-behaved folder. It’s usually the “Authenticated Users” group that would suddenly disappear, so add it (Edit->Add, then type in “Authenticated Users”) again and give it the same permissions as your other, well-behaved folder.
If you still have a problem, write a comment below and we’ll try to help. Please, no links to sites or any other spam.