Can't delete directory I am the owner of.

W G 0 Reputation points
2024-06-24T22:25:20.5433333+00:00

I am having trouble deleting a folder in my 'Program Files' directory. I have looked around and tried several methods, including changing the ownership, editing the permissions, forcefully deleting using an Admin console, and using " takeown -> icacls /grant :F -> del ".

After trying the last method, trying to use 'icacls <Folder> /grant <User>:F' gave me an access denied message even after taking ownership. Is there any other way to force remove this folder short of reformatting my drive?

Even when the permissions/ownership were de-escalated to be managed by any user, I would still get a message saying "you require permerssion from Users to delete this file".

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Jing Zhou 7,765 Reputation points Microsoft External Staff
    2024-06-25T09:14:41.4866667+00:00

    Hello,

    Thank you for posting in Q&A forum.

    Based on your description, this situation may be due to certain files or subfolders in the folder having special permission settings that prevent you from deleting the entire folder. You can try the following methods to solve this problem:

    Attempt to delete folder in safe mode. Sometimes in safe mode, the system loads the fewest drivers and services, which may allow you to delete folders.

    Try running the command prompt to delete a folder as an administrator. You can try using the command "rd/s/q<FolderName>" to forcibly delete a folder and all its contents.

    Check if there are other programs or processes using the folder. Sometimes folders are locked by other programs, making it impossible to delete them.

    Run a disk check tool to scan and fix possible file system errors. Sometimes file system errors may prevent folders from being deleted.

    If the above methods still fail to solve the problem, you may need to further investigate the permission settings of specific files or subfolders in the folder to ensure that you have sufficient permissions to delete them. If you need more help or have any further questions, please feel free to let me know and I will do my best to provide more support.

    Best regards,

    Jill Zhou


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

  2. Anonymous
    2024-06-25T09:16:26.0566667+00:00

    Hello,

    Thank you for posting in Q&A forum.

    Based on the information you provided, I suggest you refer to the following method to force delete the file:

    1. Create a new text document and copy and paste the following command into the text document.

    DEL /F /A /Q \?%1

    RD /S /Q \?%1

    User's image

    1. Save the text file as "del_files.bat".
    2. Drag the files or folders to be deleted onto the files_del.bat file.

    I hope the information above is helpful.

    Best regards

    Zunhui

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.