2

I only copied one folder node_modules from D:/some_folder/node_modules to C:/another_folder/node_modules and now cannot delete C:/another_folder/node_modules. It says I need administrative privileges.

I am the owner.

I am the administrator.

I've tried few command lines I found here like this one: https://superuser.com/a/1580457 and rmdir /s /q C:\ProgramData\FolderToDelete this one, but nothing is working. I looked in process explorer and I see nothing about the folder.

What else can I try?

cikatomo
  • 133
  • 1
  • 5
  • Please provide a screenshot of the ACL for the folder in question. Please edit your question to provide this relevant and required information – Ramhound Oct 21 '20 at 13:52
  • A second reason for folders that can not be delete are if a process has still a handle open to the folder (this also ends up in the "access denied" error). You can use ProcessExplorer search for handle to identify the process that "locks" the directory. – Robert Oct 21 '20 at 13:56
  • A third possibility are a defect Windows ACL for that directory. I would do a `chkdsk` run on the drive. And last but not least in some very rare cases only a reboot of the system can make some folders deletable again (I had once such a case with the LibreOffice installation directory which could not be deleted unless I rebooted). – Robert Oct 21 '20 at 14:20
  • What method are you using to attempt deletion of the folder? Explorer? Did you click on the "Continue" button with the yellow/blue shield icon? Something else? FYI, being the owner and an administrator does NOT give you automatic access rights to files. – kreemoweet Oct 21 '20 at 18:58
  • Hi, please whether the following guides are helpful to you:https://superuser.com/questions/204909/cant-delete-folder-and-i-am-admin-you-need-permission-to-perform-this-action https://www.addictivetips.com/windows-tips/administrator-permission-delete-folder/ – Gloria Gu Oct 22 '20 at 08:25
  • If your question is resolved and you don't desire additional explanation or details, be sure to select a "Best Answer", based on the answer that you feel best answered the question you asked. This benefits the exchange userbase by pulling this question out of the "Unanswered Questions" so that people looking to help and answer questions don't spend time reading through questions just to see that they already have proper answers. If not, and you issue is unresolved, or you require further details, let us know. Thank you! – Hashgrammer Oct 22 '20 at 14:10

1 Answers1

2

Attempt to delete the folder in question from an Elevated Command Prompt from a Safe boot.

For the non-tech-savvy, you may want to write down or print these instructions out before proceeding.

  1. Press ⊞ + R, type "msconfig" without the quotes, and press Enter
  2. Switch to the "Boot" tab, check the "Safe boot" checkbox, and leave it set to Minimal.
  3. Hit "Apply", hit "OK", and restart the computer.
  4. The system will boot into Safe Mode, loading only necessary processes and services.
  5. Press ⊞ + R, type "cmd" without the quotes, Hold CTRL + SHIFT, and while holding CTRL + SHIFT, press Enter. This will open an elevated command prompt with administrator privileges.

Alternatively, for step 5 you can Right-click the Start Button on your task bar, and >Select "Windows Powershell (Admin)", although powershell has differences from cmd.

  1. Attempt to run the command rmdir /s /q C:\path\to\FolderToDelete where the last part is the path to your actual desired directory to remove. Be warned that this will delete the directory, as well as any directories or files inside of it!

Once you have resolved the problem, follow steps 1, 2, and 3 again, with the exception of UNCHECKING "Safe boot" instead of checking it. This will get your system back into a normally booting situation.

Hashgrammer
  • 389
  • 1
  • 7
  • thanks for detailed answer, but all I had to do was restart computer – cikatomo Oct 24 '20 at 02:32
  • In the future however, if you run into a file that is being locked for use on startup, restarting the computer won't help, however, this answer will take care of that. Always good information to have. You can also force unlocks and then just delete it anyways without any restarting or fancy footwork. There used to be a great third party application for that, I believe it was, funny enough, named Unlocker. – Hashgrammer Oct 26 '20 at 18:11
  • yes good old Unlocker was great, but unfortunately it seems it doesn't work for win10. – cikatomo Oct 26 '20 at 23:00
  • 1
    Boo :( that's unfortunate. Well, at least in a total pinch, you know how to handle it for sure. – Hashgrammer Oct 27 '20 at 12:18