Ubuntu – Delete corrupted folder

filesystem

I am trying to delete a folder in my home directory; its name is completely garbled. In Nautilus, the garbled text is followed by 'Invalid Directory.'

Deleting it with Nautilus stalls; I can't type in the garbled name in the terminal.

peter@io_vbox:~$ ls -lbdR *
...
drwxrwxr-x 3 peter peter      4096 Jul 28 15:19 \346>\3152\357+\332)\363*\356,\253-\277+H&\266\033z\v\373\366\340\340?\314\022\274P\262\003\260鵿\303p\326\342\351\214\374f\016X\036r)!.\026
...

Any ideas?

Running 12.04; if it's of any importance, this is running in VirtualBox on a Macbook Air. It was installed through VirtualBox. I don't have any other signs of SSD failure that I've picked up on — referring to this question: Random files (invalid encoding) appearing in home directory

Thanks

Best Answer

When a file / dir has special characters and won't delete, you can try to remove it using it's inode number more information on inodes in ext3.

To do so,

  1. open a terminal window.
  2. Change directory cd to the location of the files or directories with the "special characters".
  3. Run

    ls -lbdRi *
    1312883 drwxrwxr-x 2 me me 4096 Aug 31 11:49 special-character`
    

    Note the "inode" number (Here 1312883)

  4. Then run a find and remove on that "inode"

     find . -inum 1312883 -exec rm -rf {} \;
     find: ``./special-character': No such file or directory
    
  5. and then to make sure that is has gone.

     ls -lbdRi *
     ls: cannot access *: No such file or directory
    

I hope that this helps.