1

I've encountered a really weird problem on a NAS volume I'm accessing on OS X. I have a PNG file that I tried to delete, but something went wrong and it still appears when I run ls or view the directory in Finder (icon is blank, though). Here's where it gets freaky:

  • Running plain ls lists the file along with everything that does exist, no problem. Same thing with ls -a, -h, or -w.

  • If I run ls with -l or -i, or try to rm or mv the file, I get the error "No such file or directory" instead of output. Everything else that should show up does.

  • Running ls -s prints

    0 3-keys-to-manifestation-og.png
    

So I've got a file with zero size, that I cannot delete or rename. There is no issue with special characters in the filename, as was suggested with similar problems.

Any ideas about what happened, and how I can get rid of this thing?

put on hold as unclear what you're asking by Kusalananda 15 hours ago

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    So what is the output of ls | hexdump -C? – Stephen Rauch Mar 14 '17 at 6:16
  • What's your rm command? Are you using wrong path? – FrontENG Mar 14 '17 at 6:33
  • What happens if you stat the file? – Wildcard Mar 14 '17 at 7:09
  • See whether find . -maxdepth 1 -name '*3-keys-to-manifestation-og.png*' -delete helps. – phk Mar 14 '17 at 15:37
  • What are directory permissions ? If you don't have write permissions on directory, you cannot add or remove files, because creating or removing files modifies directory listing. – Sergiy Kolodyazhnyy Oct 11 at 7:29
0

Try to echo some content into the file and delete it then.

echo "Some Text" > 3-keys-to-manifestation-og.png && rm 3-keys-to-manifestation-og.png

I cannot say why this file is still shown in ls, but maybe you can delete it after it was "created" with the echo command.

If the file still exist, echo will overwrite its content with "Some Text". If it is not there anymore, it will be created and filled with "Some Text". Afterwards it should be possible to delete it.

0

I had a file which showed up via ls, but I couldn't rm it.

I was able to mv the file to a new directory.

In my specific case to get the file to show up in ls I had to use a wildcard (e.g. ls ./some*.jpeg) and I had to use the same wild card in mv (e.g. mv ./some*.jpeg ./newdir). Also, in my case I wanted to actually keep the file (but it was corrupted). However, once I moved the file to a new directory, I was able to move it back to the original directory and the file was no longer corrupted.

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