error removing file no such file or directory

9,506

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

Share:
9,506

Related videos on Youtube

Talha Javaid
Author by

Talha Javaid

Updated on September 18, 2022

Comments

  • Talha Javaid
    Talha Javaid over 1 year

    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

    • Talha Javaid
      Talha Javaid almost 9 years
      I've tried. Command returns the same error.
    • kos
      kos almost 9 years
      Please post the exact command you're running and the exact output
    • Bulrush
      Bulrush almost 9 years
      Can you do rm Final*.xlsx? Does that work? I suspect the '+' signs are causing you trouble, which is why I only use letters, numbers, dash and underscore in a filename on every OS I use. Can you start up a GUI file manager and delete it that way?
    • Talha Javaid
      Talha Javaid almost 9 years
      no it didn't work
    • Bulrush
      Bulrush almost 9 years
      Do this: ls -l Final*.xlsx and post the results to your original message. We need to see the owner and permissions.
    • kos
      kos almost 9 years
      While in ~/Desktop, type rm Final than hit TAB to use auto-completion to match the exact filename and report back. If this doesn't succeed I fear you might have a corrupted filesystem.
    • Mark Kirby
      Mark Kirby almost 9 years
    • Talha Javaid
      Talha Javaid almost 9 years
      GUI desktop Gnome
  • Talha Javaid
    Talha Javaid almost 9 years
    I tried but rm returns the same error
  • Edward Torvalds
    Edward Torvalds almost 9 years
    @TalhaJavaid remove all the files from desktop (except the one you want to delete) and run this cd ~/Desktop; \rm -i -- *