2

I am not being able to delete certain files with an error no such file or directory. A file on my desktop as well as a file in my movies folder is not being deleted.

I am 100% sure the problem isn't with the name of the file because I always use tab key to auto complete the name.

Error

enter image description here enter image description here

  • Try to delete them in a terminal like this ` rm /path/to/your/file` and add any errors to your question – Mark Kirby Jun 22 '15 at 18:55
  • I've tried. Command returns the same error. – Talha Javaid Jun 22 '15 at 19:06
  • You did not provide the error that is what I want, please add it to your question – Mark Kirby Jun 22 '15 at 19:08
  • the heading is the error . I have added it to the question too. – Talha Javaid Jun 22 '15 at 19:10
  • Sorry I was expecting more from terminal – Mark Kirby Jun 22 '15 at 19:10
1

the name of the file must contain a non-printing character i.e. a character that is not printed even if is there.

you should try this:

ls -b <your file> | xargs rm

you should get the full name of that file by typing the first few letters then pressing tab

  • I tried but rm returns the same error – Talha Javaid Jun 23 '15 at 14:02
  • 1
    @TalhaJavaid remove all the files from desktop (except the one you want to delete) and run this cd ~/Desktop; \rm -i -- * – Edward Torvalds Jun 23 '15 at 14:57
0

Open a terminal and type:

rm or sudo rm remember this is for a file not a directory, if it's directory then rm -r, more detailed man rm.

Now when you typed rm command just drag&drop that file to a terminal, it will also print/show you a complete and correct path to that file, out of it you can notice if you made any mistakes when providing a path to a file before. And then just hit Enter that's it.

If you still unable to delete it, follow this duplicated link.

0

As you didn't do a 'ls -l ~/Desktop' it is hard to know what exactly is the problem. Would be nice if you could update your post with that.

The absolute simplest solution is to let the terminal find out the exact name itself by autocompletion. Genereally you just start to write the command and then hit the tab key.

rm F[Tab-key]

It should then write out the whole name of the file. You might possibly have to press Tab twice for it to do that.

0

I had the same problem as yours, only with a folder, not with a file. None of the methods suggested here worked.

I managed to solve the problem by creating a folder in the same position and with the same name as the one I couldn't delete. The folder was created correctly and it "replaced" the non existing one. Then I simply removed the new folder and the issue was gone. Simply as that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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