39

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!

2
  • 3
    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
  • How do you delete the file without mounting? – Stephen Boston Aug 31 '18 at 20:29
21

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.

2
  • 1
    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
72

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.

3
  • 8
    THIS answer is the one which actually solves the problem – Martin Erhardt Jul 8 '13 at 17:23
  • Thanks, it works. I used this answer and saw a bunch of stuff that was using my folders. Rebooted, then tried to see the same list again - it was empty. And then the deletion went smoothly. – Sevastyan Jul 18 '18 at 7:35
  • Year 2020 here, and still this happens :) In my case to solve the problem I just need to move to the directory with "cd /path/to/folder/that/cointains/tempfiles" and FUSE temp files disappears. – Giuseppe Bertone Sep 8 '20 at 12:34
18

For external hard disks this problem could be resolved by,

  • Right Click on the folder and select Move to Trash
  • Empty the Trash

It worked for me even if rm -rf didn't work.

2
  • 2
    Yes this works. Why?! However the files are then in the trash and are just as problematic. – Stephen Boston Aug 31 '18 at 20:16
  • Had the same problem, did an 'ls -la' on the inner folder and found 'input/output error' and this solution worked perfectly. It also means there may be a larger problem, some disk error (bad block/hardware), that needs fixing or replacement. – Ajay Singh Nov 21 '20 at 21:56
-1

If on the mac, be aware also of *.localized files, which may become invisible even to 'ls -la', 'find' and their ilk on a FUSE filesystem. [ This discovered using a ConnectedData Transporter-created FUSE filesystem on a MacBook Pro.]

-1

This can happen when you are seeding a file in a torrent client too. Just make sure you shut off the torrent client, or remove the seeding torrent.

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