Linux Directory – Cannot Remove Directory: Directory Not Empty

directory

I tried to delete some directory, but

$ rm DE.aspx_files -r
rm: cannot remove `DE.aspx_files': Directory not empty

But listing its content returns none

$ ls DE.aspx_files
$

Added: Actually

$ ls -la DE.aspx_files

total 4
drwx------ 1 ting ting 4096 Sep 14 20:48 .
drwx------ 1 ting ting    0 Sep 13 22:34 ..
-rw------- 1 ting ting    0 Sep 13 22:34 .fuse_hidden0001d4bf00000006

When I try to rm .fuse_hidden0001d4bf00000006, it is deleted, but another new .fuse_hidden0001d4bf00000007 created.

So I wonder what happened, and how to fix this problem?

Note: it is a newly bought external portable HDD, and I just copy some files to it using a data recovery program.

OS: Ubuntu 12.04

Thanks!

Best Answer

Hidden Files

You may have hidden files. You can find them with ls -la to make sure you're okay with really deleting them first. Then you can delete the files before running rm -r or rmdir as needed.

Forcing the Recursive Delete

You can also just do rm -rf to force the recursive deletion even if the target directory contains files. All the usual warnings apply, but it will get the job done regardless of what your directory contains--as long as you have permissions to delete the files and directories, of course.

Related Question