Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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!

share|improve this question
    
You need to figure out what's mounting a FUSE filesystem there. Try mount | fgrep fuse to find it, and fusermount -u <mountpoint> to unmount it before trying to delete your directory. –  CodeGnome Sep 15 '12 at 2:24

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer
    
also, you can run find DE.aspx_files -exec ls -la {} \; to identify hidden files, or files named with special characters. –  Tim Kennedy Sep 15 '12 at 0:49
    
Thanks, I have identified the culprit hidden file, which can be deleted but a new sibling is generated. Please see my added part. Forcing deletion doesn't work either, because "Directory not empty". –  Tim Sep 15 '12 at 0:52

Files of the form .fuse_hidden* are created by FUSE filesystems when a file is deleted but still in use somewhere and must still have a directory entry. This is similar to .nfs* files on directories exported over NFS.

Run df -T . to see the type of filesystem that's mounted on the current directory and its mount point. For an external hard disk, chances are that this is an NTFS filesystem mounted through the NTFS-3G driver, which is base on FUSE.

The name is a fake name that the filesystem driver invents for a deleted file. You can't delete the file (or rather, if you create the file, it reappears under another name). You can't delete the directory either, since it isn't empty. You'll need to find what is using this file. The most likely cause of being in use is if it's open by some application. Run lsof /media/mount-point where /media/mount-point is the filesystem mount point and look for an open file in that directory.

share|improve this answer
    
THIS answer is the one which actually solves the problem –  Martin Erhardt Jul 8 '13 at 17:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.