rm: cannot remove 'file': No such file or directory

25,825

First of all please check if your filesystem is consistent. As you use NTFS you should better do this on windows.

BackInTime changes permission of all files and folders so you can't accidentally change or remove your backup. Please use either BackInTimes GUI to remove the whole snapshot or parts of it, or change permissions first:

find /path/to/backintime/HOST/USER/PROFILE/SNAPSHOTID/backup -type d -exec chmod u+wx {} +
rm /path/to/backintime/HOST/USER/PROFILE/SNAPSHOTID/backup/file/to/remove

Edit

According to your comment your drive was already inconsistent. This means other files could be corrupt, too. rsync normally compares only files size and modification time to decide whether a file needs to be synced. This will not detect corrupted files.

So please take one new snapshot with

backintime --profile-id 1 --checksum --backup

for all profiles. This will take ages but in the end your backup will be safe again.

Disclaimer: I'm the current main Dev of BackInTime

Share:
25,825

Related videos on Youtube

Sekhemty
Author by

Sekhemty

_

Updated on September 18, 2022

Comments

  • Sekhemty
    Sekhemty almost 2 years

    I need to delete some files under Linux, but when I try to do so, I always get the same error: rm: cannot remove 'file': No such file or directory. The problem is that the said files are visible with every file manager and with ls, and I can even open it with their respective applications (i.e. I can open and read text files with Kate, images with Gwenview, and so on); so I can't understand why when I try to delete them, they are marked as non-existent.

    If it is helpful, these are backup files, they are on a removable NTFS hard-disk and they are all inside the folder of a failed backup task; they were created by Back in Time: this program works by comparing subsequent backups and hardlinking when files are not changed in order to save space; I suppose this has something to do with the current problem.

    How can I delete these files? I tried to use rm -f without any success (even with sudo). They are still there and they are still non-existent; even under Windows, I was unable to delete them; what else can I try to do?

    P.S. I've already asked advice to Schrodinger's Cat, with no success.


    Here is a sample of the names of these files:

    rcb-ScrollBarH_bar_focus.png  rcb-separator_vertical.png  ScrollBarNib.png  thumbborder-thin-black.png
    rcb-ScrollBarV_bar_focus.png  scrollbarh_bar_focus.png    scrollbarv.png    thumbborder-thin.png
    
    • MariusMatutiae
      MariusMatutiae over 8 years
      Can you post a listing of these files' names?
    • Sekhemty
      Sekhemty over 8 years
      These files are located in many different folders, as I said they were created by a backup task.
    • choroba
      choroba over 8 years
      Don't the names contain some unprintable characters?
    • MariusMatutiae
      MariusMatutiae over 8 years
      Doesn't matter, please show at least some of them, using ls -h
    • Sekhemty
      Sekhemty over 8 years
      I've edited my question as requested; however, it doesn't seem that these filenames contain any strange character.
    • nKn
      nKn over 8 years
      Try running \rm filename (yes, with the backslash)
    • ejbytes
      ejbytes over 8 years
      "ls -a", will allow you to see the files that you cannot see with only "ls". That way you can see if you are typing the file name exactly correct, upper/lower case is sensitive and matters. Possibly you'll have to use a force remove and that would be: "rm –f file_name". Good luck! I think "sudo rm -f" doesn't work. You'll have to log in as admin or super user. Log in as superuser: cyberciti.biz/faq/linux-login-as-super-user
    • ejbytes
      ejbytes over 8 years
      Also another link, helpful for su / root: howtogeek.com/111479/…
  • Sekhemty
    Sekhemty over 8 years
    Thank you very much for your answer and for the insights on how BackInTime works. I have run a chkdsk /F on Windows and it solved the problem, I was then able to delete the former un-deletable folders and files.
  • Germar
    Germar over 8 years
    Please read my edit