Could not remove the folder [Folder name]. Show more details Error removing file: Directory not empty Cancel-Skip All-Skip
I tried to delete these folders from terminal with:
Did you try
I had this same issue with a folder on a btrfs filesystem. Checking mount points and lsof are the normal things to look for. Btrfs can have a similar cause with subvolumes:
The normal things to check for:
The basic workaround if it cannot be easily fixed is to back up, format the filesystem, and restore (leaving out the bad data). Depending on how much data you have in the filesystem, this can be a chore. :-/
In my case the problem folder was inside a subvolume so I was able to do the above but by deleting only the subvolume instead of the entire filesystem. I backed up my data and simply deleted the subvolume btrfs sub del <subvolume-path>. I then restored my data into the subvolume, leaving out the problem folder.
Corruption of i_size
The cause was found to be a corruption with i_size. The folder's i_size was non-zero. Btrfs uses the i_size to tell whether or not the folder is empty. To check on this, run:
The i_size of an empty folder in btrfs should be zero. In ext I believe it should be 4k.
Go to the folder right before the one you want to delete and execute this command changing foldername by the name of your folder: rm -rf foldername
R means recursive, and f means force.