Can't delete a folder
When you cannot delete a file or folder in Windows, there are usually four problems:
- Its NTFS permissions are preventing you. (You are saying you have tried this one, so I won't elaborate.)
-
It is open in another app. Windows sometimes tells you which. Other times, you must find out for yourself, using third-party utilities like Process Explorer and Process Hacker. In order to find out:
- Download, install and run either. Run with administrative privileges.
- Press CTRL+F.
- Type the name of the file or folder you are looking for and pressEnter.
-
Look for entries whose "Type" column reads "File". If there are positive matches, either close the process locking the file or folder, or visit the process's entry and close the handle to the file or folder.
In Process Explorer, clicking on the entry takes you to the handle. You can then right-click and select "Close Handle". In Process Hacker, though, you must right-click and choose "Go to owning process". Then right-click on the process's name, select "Properties" and find the handle there.
In addition, instead of Process Explorer and Process Hacker, you can boot your system into Repair Mode (a copy of Windows RE) and delete the file there, where the intervening app is not open!
The file or folder name is using illegal characters, making it impossible for the file system to delete it. Try deleting them with Far Manager.
- (This one doesn't apply to you, but I include it for completeness.) The disk might be write-protected. No just deliberately by the user; some USB flash drives sometimes malfunction and ... oh, well, long story. Never mind.
What is the exact path of the folder you're trying to delete?
Your unsuccessful attempts to take ownership sounds like it might be a permissions issue, but some folders also have symbolic links or junction points under them that cause odd scenarios that Windows has a hard time dealing with causing it to show you invalid error messages. In these circumstances I usually have better luck with the command line.
Maybe trying one of the following from an administrative command prompt and posting the results (if it doesn't work) would help us diagnose your problem.
rmdir /s /q C:\ProgramData\FolderToDelete
Or create an empty folder somewhere and then use RoboCopy to delete the contents of the folder you want to delete.
robocopy C:\EmptyFolder C:\ProgramData\FolderToDelete /purge
Once the folder is emptied using the RoboCooy command above, you might be able to delete it using normal methods in File Explorer or using the previous rmdir
command above.
Something that worked for me:
- Open CMD as Administrator
- Type:
rd /s "\\?\D:\path\to\folder "
Notice the blank space after folder. Try the above command, if it doesn't work, remove the space and then try it.
It should work with either of the ways. Of course, my folder was in D. Yours could be anywhere. Change it accordingly