Removing files that do not exist

filesfilesystems

I apologize for the possibly misleading title, but it is the best way I could think of to describe the problem, which is: I have several files that I can cat, but when I try to rm them I get a "No such file or directory" error.

$ cat "A11 D5 D5.txt"
... OUTPUT ...
$ rm -f "A11 D5 D5.txt"
rm: cannot remove `A11 D5 D5.txt': No such file or directory

I've tried overwriting the file and can execute the remove without error, but the file is still there; I can still cat the file.

$ echo "Boom" > "A11 D5 D5.txt"
$ cat "A11 D5 D5.txt"
Boom
$ rm -f "A11 D5 D5.txt"
$ cat "A11 D5 D5.txt"
Boom
$ rm -f "A11 D5 D5.txt"
rm: cannot remove `A11 D5 D5.txt': No such file or directory

I'm at a complete loss. I suspect a reboot would fix the problem, but I am really more interested in why such a thing would happen. Some sort of filesystem problem? (I don't have reboot privileges for the system; it's a university cluster.)

Edit: I get the following output

$ ls
A11 D5 D5.txt
$ ls -b
A11\ D5\ D5.txt
$ printf '<%q>\n'
<''>

I've also stated the file (just in case):

$ stat A11\ D5\ D5.txt 
  File: `A11 D5 D5.txt'
  Size: 5               Blocks: 8          IO Block: 131072 regular file
Device: 1bh/27d Inode: 18446744068941111933  Links: 1
Access: (0644/-rw-r--r--)  Uid: (  596/  <username>)   Gid: ( 1015/<group>)
Access: 2012-12-09 22:48:29.000000000 -0600
Modify: 2012-12-09 22:56:44.835662498 -0600
Change: 2012-12-09 22:56:44.835662498 -0600

Edit 2: The filesystem is apparently of type "fuse" and

$ ls -lb A11\ D5\ D5.txt
-rw-r--r-- 1 <username> <group> 5 Dec  9 22:56 A11\ D5\ D5.txt

Best Answer

You can try to using tools to determine the filename for you if you think it has some special characters you can't see.

ls | xargs -i rm -i {}

or

find . -exec rm -i {} \;
Related Question