Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a file:

På hjul.mkv

When trying to move or delete file I get

rm: can't remove 'På Hjul.mkv': No such file or directory

The same thing happens when trying to issue $ rm *P* or the like:

wobba:/media/disk/ # rm P*
rm: can't remove 'På Hjul.mkv': No such file or directory

What can I do to get it removed or renamed?

EDIT: The operating system I am using is the Debian based Openelec Media Center. The hardddrive is formatted with NTFS and a system restart does not help.

ls -l P* acts the same as rm P* when it comes to the name:

wobba:/media/disk/ # ls -l P*
-rw-------    1 root     root     1395882911 Apr 25 11:17 På Hjul.mkv

EDIT2: Openelec uses BusyBox, which does not incorporate -inum to find inode number in its find command.

share|improve this question
    
This looks weird. Any more information? Which OS, which file system, which character set (iso8859-1, utf-8) do you use? What's the output of "ls -l *P*"? –  Uwe Apr 25 '13 at 21:54
    
That sounds like a corrupt file, does a system restart help? –  James Young Apr 25 '13 at 22:10
    
Is this a Windows file system (disk) mounted on a *nix system (or vice-versa)? See if you can access it with the OS that created it. –  Scott Apr 25 '13 at 23:14
    
I've editet the question. @Uwe How do I find which charset I am using? I think I am using UTF-8 though –  Wilhelmsen Apr 26 '13 at 7:45
    
What's the output of "echo $LC_CTYPE"? Does it contain ".UTF-8"? –  Uwe Apr 26 '13 at 8:22

3 Answers 3

Try deleting it by file id which is normally inode number on ext based filesystems, but for NTFS I'm hoping it'll expose the NFTS file id equivalent which is what you can attempt to use to delete it.

There are no guarantees this will work, but worth trying. Something like:

matt@mattdev::/tmp/ls -il
total 0   
20090 -rw------- 1 matt matt  0 Apr 26 18:27 tmpQJyK5Q
16284 -rw-rw-r-- 1 matt matt  0 Apr 26 18:26 unity_support_test.0

followed by:

find . -inum 20090 -exec rm -i {} \;

Of course, the above is not using NTFS but ext4. I'm curious to know if it works or not.

share|improve this answer
    
Damnit, Openelec use BusyBox v1.21.0, and it doesn't have the -inum parameter in find :\ Otherwise, good idea! –  Wilhelmsen Apr 26 '13 at 16:00

Btw, I just had this issue on BusyBox and this solved it for me:

$ rm -i *   # CAUTION Be **SURE** you include the '-i' on this command! CAUTION

Then, I just answered no to all the files in that directory until I got to the problematic one (in my case, an unprintable char showing up as a question mark, as in: ?filename and then I answered yes). Poof. You can ctrl-c the interative rm once you've reached the problematic file.

share|improve this answer
    
I posted this to the BusyBox mailing list since both issues in this thread were users using BusyBox; just to make them aware of it. I accidentally started a rather long (and on-going) discussion, if anybody is interested: lists.busybox.net/pipermail/busybox/2014-May/thread.html#80958 –  Jason C May 31 at 1:38

To actually get this done I had to use Samba share and delete the file from a Windows computer in the same network. Even so, renaming or moving did not work over Samba either, only removal.

Thanks Scott.

share|improve this answer
    
In other words, you used my suggestion. –  Scott May 2 '13 at 21:28
    
"See if you can access it with the OS that created it", Windows did not create it, but yes, it's quite close to what you mentioned. –  Wilhelmsen May 3 '13 at 5:20
    
I join the others who feel that this is a weird problem. Did you originally create the På hjul.mkv file on your OpenELEC (Linux) system? Can you do it again? If you do, do you have the same problem again, that you can ls the file but not rm it? Because it would be really weird for a system to be able to create a file that it cannot delete. –  Scott May 5 '13 at 20:17

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.