How can I delete a file that "Does not exist"

File exists on a Synology 5-Bay NAS.

It appears there was an error with the file name, it contains two invalid characters as well as a few others that were changed. (I have the original file elsewhere).

I just want to delete it entirely, i have a copy of it but the fact the broken one "exists" is messing with one of my Syncback jobs. (cant copy, move, delete, rename.)

I have waited a day to try again and the problem still persists. Not entirely sure when the problem started though.

Attached are two screenshots, one from windows explorer, the other from SSHing into the NAS and attempting to delete it that way.

(NOTE: the file path has been blurred, but is nowhere near the limit for windows, path is 127 characters, file name is 37 characters, totaling 165 characters.)

Windows Explorer attempt: Item not found for deletion

SSH attempt: ssh no such file or directory


There are a few things you can try (assuming the NAS is running some kind of Gnu/Linux):

  • rm Kinetix*.L5X
  • find -name "Kinetix*.L5X" -delete, assuming your find supports -delete, if it doesn't use this instead: find -name "Kinetix*.L5X" -exec rm -i '{}'
  • Delete it using the inode, first get the inode:

    ls -i Kinetix*.L5X
    

    That will return something like NNNNNNNN FILENAME where the Ns are the inode number. Now, pass that number to find:

    find . -inum [inode-number] -exec rm -i '{}' \;