How to get rid of "Bad Message" file?

So I recently had a (corrupted?) file which kept displaying "Bad Message" whenever I try to examine or really, do anything with it. rm filename did not do the trick, still got the same message.

rm: cannot remove 'TheLegend27.zip': Bad message

When I try to view it via Files, I also get the same message, and the file doesn't show. After a bit of failed researching, I ended up deleting the directory itself which seemed to remove the file as well. For future reference, how would I remove these files with "Bad Message"? I do not want to delete the directory in case there are tons of files in them, in this case, I only had one.

I am using Manjaro 18.0.4 with DE Gnome, kernel 5.1.16-1 (linux51).
If I am posting in the wrong section of the forums, my apologies, I am just very curious about what I should do in the future if I encounter this situation again.

I'm sure there's easier ways to do this. Since I've never had this issue, I had to hit tehgoogles.

I found this. He's using inodes to identify the offending file, then nukes it.

First list bad file with inode e.g.

$ ls –il
Output

14071947 -rw-r--r-- 1 dba 0 2010-01-27 15:49 -®Å

Note: 14071947 is inode number.

Now Use find command to delete file by inode:
$ find . -inum 14071947 -exec rm -f {} ;
It will find that bad file and will remove it with force i.e remove without prompt.

From here:

https://bbs.archlinux.org/viewtopic.php?id=96023

5 Likes

Right, I've come across that while researching. However, when I ran ls -il in the corrupted file dir, all the output except the filename was in ?, so I could not get the inode number. I hope it was a one-time thing. Thanks for the reply though!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by