Cannot Remove Folder, Directory is not empty. (SOLVED)

The error message “Cannot delete folder, directory is not empty” can be faced on any Windows based computer (Windows 10, 8, 7, Vista or XP) if you try to delete a folder that the system cannot access due to the permissions applied to it. In other cases the “Cannot Remove folder because the directory is not empty” issue, can be solved after scanning the hard disk for errors by using the “CHKDSK” command.

Cannot Remove Folder, Directory is not empty

In this tutorial you will find detailed instructions on how to resolve the following errors while deleting a file or folder on Windows 10, 8, 7, Vista or XP:

    • “Cannot remove Folder or File. The Directory is not Empty”
    • “Folder Access Denied. You need permission to perform this action”
    • “Cannot delete file. Cannot read from the source file or disk”
    • “Cannot Remove Folder. Cannot find the specified file”
    • Cannot Delete a File or Folder error in Windows.

How to fix: Cannot Remove Folder or File. The Directory is Not Empty or Access is Denied

Method 1. Run CHKDSK on the drive.

The first step to resolve the ?Cannot remove folder” or “Cannot remove file”  issue(s), is to perform a check disk scan on the disk, that contains the folder that we cannot delete.

1. Open an elevated command prompt (Command Prompt (Admin)).

Cannot Delete Folder Directory is not empty

 

2. In the command prompt window, type the following command and press Enter: *

  • chkdsk c: /F /R

* Press the “Y” key if asked to check your disk the next time your system restarts.

Cannot Remove Folder Directory is not empty

3. After disk checking try to delete the problematic folder (or file). If you still cannot remove the folder, proceed to method-2.

Method 2. Modify Folder’s (or File’s) Permissions.

1. In Windows explorer, right click at the folder that you cannot delete and select Properties.
2. Select the Security tab and then click Advanced.

fix error deleting folder

3. Click Change Owner

fix error deleting file

4. In the object name box type, type the name of the Administrator account (e.g. “User1” in this example) and then click OK.

Cannot Delete a File or Folder error in Windows

 

5. Check the “Replace Owner on subcontainers and objects” checkbox and then click OK & OK again to close the security settings.

Cannot Remove Folder. Cannot find the specified file

 

6. Now try to delete the folder (or the file) that you cannot delete. If you receive the same message, then proceed to method-3 below.

 

Method 3. Delete File or Folder from Command Prompt.

1. Open an elevated command prompt (Command Prompt (Admin)).

2. In elevated command prompt, give the below commands, according your case:

A. To delete a folder: *

  • takeown /F “FolderName” /r /d y
  • icacls “FolderName” /grant Username:F /t
  • rd “FolderName” /S /Q

* Notes:
1. Replace the “FolderName” with the full path and the name of the folder that you cannot delete.
2. Replace the “Username” with the username of the Administrator account.

e.g: if you want to delete the “Demo” folder (and its subfolders and files) under the “C:Program Files” directory and your Administrator account name is “User1”, then the commands should be:

    • takeown /F “C:Program FilesDemo” /r /d y
    • icacls “C:Program FilesDemo” /grant User1:F /t
    • rd “C:Program FilesDemo” /S /Q

 

B. To delete a file: *

    • takeown /F “Filename”
    • icacls “Filename” /grant Username:F
    • del “Filename”

* Notes:
1. Replace the “Filename” with the full path and the name of the file that you cannot delete.
2. Replace the “Username” with the username of the Administrator account

e.g. if you want to delete the “Example.doc” file under the “C:Temp” directory and your Admin account name is User1, then the commands should be:

    • takeown /F “C:TempExample.doc”
    • icacls “C:TempExample.doc” /grant User1:F
    • del “C:TempExample.doc”

 

That’s all folks! Did it work for you?

Please leave a comment in the comment section below or even better: like and share this blog post in the social networks to help spread the word about this solution.

If this article was useful for you, please consider supporting us by making a donation. Even $1 can a make a huge difference for us.

Hình ảnh thuộc sở hữu của trang web qnet88.com

Đánh giá post
[related_posts_by_tax posts_per_page="6" title="Bài liên quan" taxonomies="category,post_tag"]

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Hotline: 0974.0707.83(Zalo/Viber)