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

5

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

Fooxz

Posted 2013-07-10T15:09:44.947

Reputation: 237

4Can you rm with wild cards in the ssh shell? Like rm Kinetix__Vrvo*.L5X? – Werner Henze – 2013-07-10T15:11:34.297

3BTW, in ssh you wrote Kinetix_Vrvo, in the explorer it is Kinetix__Vrvo!? – Werner Henze – 2013-07-10T15:12:48.473

Yeah, in explorer it looks like two _ but in SSH its just one. that file name is copied from what the ls gave me.

Wow, I don't know how I didn't think to try wildcards. I ran 'rm Kinetix*' and it deleted the bad file and the other Kinetix file in the directory. I didn't expect that to work, thanks! – Fooxz – 2013-07-10T15:20:15.937

Answers

3

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 '{}' \;
    

terdon

Posted 2013-07-10T15:09:44.947

Reputation: 45 216

1Werner Henze in the question comments mentioned trying the wildcard thing, that worked

rm Kinetix* is what I tried with success, for clarification. Thanks! – Fooxz – 2013-07-10T15:22:22.303