Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to delete a file under OSX Lion, but can't. I get the following message:

The item XYZ.txt~ can’t be moved to the Trash because it can’t be deleted.

Here's what I've tried:

  • select file and press COMMAND + DELETE (I get the message above.)
  • renaming the file in finder (There is no option to rename the file.)
  • sudo ls -a in a terminal (The file does not appear.)
  • sudo rm XYZ.txt~ (I get "No such file or directory".)

How do I remove this file?


EDIT

The file went away after restarting. My guess is that it was a glitch in finder.

share|improve this question
    
I've no experience of OSX as such, but bear in mind that when you're running sudo from a terminal, it's going to look in the current directory, not necessarily where the file XYZ.txt~ is. I'm guessing this is the source of your No such file of directory errors. –  Andy Smith Sep 12 '11 at 18:41
1  
It sounds like the file is marked read-only or is on a read-only file system (like a Windows NTFS volume). If you right click and get info, does it say you can Read & Write under Sharing and Permissions at the bottom? –  Nick Sep 12 '11 at 18:44
    
@Andy Smith -- Thanks, but I was running the sudo command from the same location as the file. –  dsg Sep 12 '11 at 18:51
    
@Nick -- When I right click on the file and click get info, nothing happens. The pop-up that usually is supposed to show up (the one that I get with other, more normal files and folders) does not show up. –  dsg Sep 12 '11 at 18:53
1  
It sounds like the file doesn't exist, I don't know why finder would be showing something like that though. What if you try to create a file XYZ.txt~ by typing touch XYZ.txt~ in that directory in the terminal, then deleting that newly created file? –  Nick Sep 12 '11 at 18:57
add comment

1 Answer

Try quitting and reopening Finder.

There is a bug where files that no longer exist are still shown on the desktop (but not if you open a separate window for ~/Desktop/). It has happened to me with .download bundles and with temporary files created by ImageMagick. The files have always disappeared after I have quit and reopened Finder.

share|improve this answer
    
Have you tried restarting Finder in such cases? –  Daniel Beck Aug 29 '12 at 8:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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