Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

"no such file or directory"--but file's listed with ls -al

How do you delete a file which is listed with "ls -al" in Terminal,

but when you try to 'sudo rm' it, you get "no such file or directory"?

The file in question is a troublesome temporary Excel spreadsheet file--something like "~$TroublesomeFile.xlsx".

When I run "ls -al", it's listed with the flags "-rw-r--r--@".

Thanks much for your time!

riprap

Posted on Jul 11, 2014 6:27 PM

Reply
2 replies

Jul 11, 2014 7:05 PM in response to riprap1951

If the file really starts with ~ then this is a "Magic" character to the shell. It says to look for your home directory.


If the file really has a $ in it, then this is a "Magic" character to the shell. It tells the shell to substitute the contents of variable TroublesomeFile in the command line. If the variable does not exist, then nothing is substituted for the variable name.


If you really have all these "Magic" characters in the file name, then protect it by using single quotes around the file name:


rm '~$TroublesomeFile.xlsx'

If that doesn't work, then please show the exact command used to try the 'rm'


AND please show the exact error message. Do not summarize.

"no such file or directory"--but file's listed with ls -al

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.