Why do I get "Directory not empty" when I try to remove an empty directory?
I had the same problem on a external hard disk, I tried so many ways using command line, but I failed every time. That's what worked for me:
- Right click on folder
- Move to trash
- Empty trash
Yes, it's silly but it worked for me (I don't really know how and why, but the damned folder no longer exist)
I have win 10 + ubuntu dual system installed. And both systems share the windows parititions.
Recently, i also ran into unable to delete empty folders in those partitions under ubuntu. I can't find out solution to solve it under linux.
However, after i switch to windows, and run
chkdsk
via cmd
for the target disk. Some errors checked out.
and then i run
chkdsk /F
to fix disk error.
After it finish, i am able to delete those folders now.
I had the same issue not able to remove directory as it is not empty.
This sequence of operations worked for me.
From command line first
sudo rmdir --ignore-fail-on-non-empty folder-name-to-be-deleted
The above command helps ubuntu ignore directory is not empty.
- Then just go to the folder and Shift + Del. That is all.