Share via

Can't delete folder error the directory is not empty.

Anonymous
2024-07-29T20:58:50+00:00

I've tried to delete a one drive folder from a disabled user on that computer but it keeps failing.

I used command rd "folder name" /s /q and I'm getting the error "the directory is not empty."

Windows for home | Windows 11 | Performance and system failures

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2024-07-30T02:14:21+00:00

    Thanks for your answer, however I was able to solve it by running chkdsk c: /f /r and then restarting the computer.

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2024-07-29T22:36:34+00:00

    Hi TechFlow. My name is Ivan, and I am an Independent Assessor. I'd be more than happy to assist you. I'm so sorry that you are experiencing this issue. Don't worry, I'll do everything I can to help you.

    This usually indicates that there are files or subfolders within the target directory that are preventing deletion.

    1. Use the attrib command to list hidden or system files:

    attrib /s /d "folder name"

    -If there are hidden or system files, you may need to use the /f switch with the rd command to force deletion:

    rd /s /q /f "folder name"

    1. Make sure you have sufficient permissions to access and modify the folder and its contents. You may need to take ownership of the folder and give yourself full control.
    2. Other applications may be using files within the folder. Close all running applications and try again.
    3. If the steps above do not work, consider using a third-party tool such as Unlocker to identify and release file locks.
    4. Delete from the OneDrive web interface: Sign in to the disabled user's OneDrive account (if possible) and try deleting the folder from there.
    5. Restart the computer in safe mode and try deleting the folder again.

    I hope one of these options can help you solve the problem, I'm very attentive if you have additional questions.

    2 people found this answer helpful.
    0 comments No comments