3

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.

  • 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? – user181734 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 – chwi 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
1

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.

  • Damnit, Openelec use BusyBox v1.21.0, and it doesn't have the -inum parameter in find :\ Otherwise, good idea! – chwi Apr 26 '13 at 16:00
1

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.

0

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.

  • 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. – chwi 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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