3

I have a file in a directory that exists:

# cat 0f7fe16ba45fda36462cb35f82ad8c64730e78 
@root

es5
module

tabs
indent 2
maxlen 80

ass
nomen
plusplus

But when I try to delete it

# rm 0f7fe16ba45fda36462cb35f82ad8c64730e78 
rm: cannot remove '0f7fe16ba45fda36462cb35f82ad8c64730e78': No such file or directory

I tried the answers in "No such file or directory" when trying to remove a file, but the file exists? but they don't work. There don't seem to be any special characters.

# ls -1b
0f7fe16ba45fda36462cb35f82ad8c64730e78
# ls -q
0f7fe16ba45fda36462cb35f82ad8c64730e78
# find . -maxdepth 1 -type f -name "*0f*"
./0f7fe16ba45fda36462cb35f82ad8c64730e78
# ls -l
total 512
-rwxrwxrwx 1 root root 63 Nov 27  2015 0f7fe16ba45fda36462cb35f82ad8c64730e78
# rm -i -- *
rm: remove regular file '0f7fe16ba45fda36462cb35f82ad8c64730e78'? y
rm: cannot remove '0f7fe16ba45fda36462cb35f82ad8c64730e78': No such file or directory
# ls --escape
0f7fe16ba45fda36462cb35f82ad8c64730e78

What's going on here? Can someone help me remove this file?

EDIT: Output of stat command:

$ stat 0f7fe16ba45fda36462cb35f82ad8c64730e78 
  File: '0f7fe16ba45fda36462cb35f82ad8c64730e78'
  Size: 63          Blocks: 1          IO Block: 4096   regular file
Device: 806h/2054d  Inode: 48177       Links: 1
Access: (0777/-rwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2016-01-04 00:06:49.697084100 -0500
Modify: 2015-11-27 20:15:19.490769000 -0500
Change: 2017-01-17 23:01:34.343100100 -0500
 Birth: -

Other commands suggested:

$ find . -maxdepth 1 -type f -name "*0f*" -delete
find: cannot delete ‘./0f7fe16ba45fda36462cb35f82ad8c64730e78’: No such file or directory
$ find . -maxdepth 1 -type f -name "*0f*" -exec stat {} +
  File: './0f7fe16ba45fda36462cb35f82ad8c64730e78'
  Size: 63          Blocks: 1          IO Block: 4096   regular file
Device: 806h/2054d  Inode: 48177       Links: 1
Access: (0777/-rwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2016-01-04 00:06:49.697084100 -0500
Modify: 2015-11-27 20:15:19.490769000 -0500
Change: 2017-01-17 23:01:34.343100100 -0500
 Birth: -
Aditya Kashi
  • 63
  • 1
  • 10
  • boot from a live CD and run fsck for the partition that has the file in question. – jsalatas Jan 18 '17 at 06:15
  • 1
    Can you stat the file and show us the output? – The Pizza Overlord Jan 18 '17 at 09:17
  • What The Pizza Overlord is saying, do `stat ` – Sergiy Kolodyazhnyy Jan 18 '17 at 16:01
  • Thanks for the replies. @jsalatas I'll try that if nothing else works; thanks for the suggestion. – Aditya Kashi Jan 19 '17 at 05:04
  • @The Pizza Overlord I've posted the output, but I can't make anything of it; hopefully it reveals something to you. – Aditya Kashi Jan 19 '17 at 05:05
  • @Serg I've posted the output, thanks for clarifying about the `stat` command, I didn't know about it. – Aditya Kashi Jan 19 '17 at 05:06
  • @muru I've pasted the output of what you asked too. The first one is giving an error.. – Aditya Kashi Jan 19 '17 at 05:15
  • @AdityaKashi should have been just `-delete` without the `-ok`, sorry: `find . -maxdepth 1 -type f -name "*0f*" -delete`, but in any case, I think this is a situation where an `fsck` is warranted. – muru Jan 19 '17 at 05:32
  • @muru Ran the corrected command. Okay, cool, thanks for your help! So this file is on a NTFS partition. I can just unmount it and run fsck right? Or do I need a live USB stick? – Aditya Kashi Jan 19 '17 at 05:47
  • @AdityaKashi yes, unmounting should be enough. But `ntfsfix` for NTFS, not fsck – muru Jan 19 '17 at 05:50
  • 1
    @AdityaKashi - Your stat output looks good to me. Aside from an inode allocation issue, I wouldn't be sure what to look at next. A file system check would be advisable, however. Out of interest, what happens when you try to interact with the file in any other way? So, renaming, for example using `mv`, or copying to another directory using `cp`. – The Pizza Overlord Jan 19 '17 at 08:19

0 Answers0