0

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
  • 1
    Can you post a listing of these files' names? – MariusMatutiae Jan 4 '16 at 11:27
  • These files are located in many different folders, as I said they were created by a backup task. – Sekhemty Jan 4 '16 at 11:36
  • 1
    Don't the names contain some unprintable characters? – choroba Jan 4 '16 at 11:36
  • Doesn't matter, please show at least some of them, using ls -h – MariusMatutiae Jan 4 '16 at 11:37
  • I've edited my question as requested; however, it doesn't seem that these filenames contain any strange character. – Sekhemty Jan 4 '16 at 19:27
1

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

  • 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. – Sekhemty Jan 5 '16 at 10:58
  • Please read my edit – Germar Jan 6 '16 at 6:28
0

This is most probally because the file has some non-printing characters or characters that look the same or due to limitaion of the ls.

Try using the --escape option of ls,or the cat tool(cat -v) to find the correct file name and then do

rm -i --* Hope this helps

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.