adrianlopezroche / fdupes

FDUPES is a program for identifying or deleting duplicate files residing within specified directories.
2.48k stars 186 forks source link

Failing to delete #175

Closed jcharbo94 closed 2 months ago

jcharbo94 commented 1 year ago

I ran a fdupes of with two folders, found 1000+ duplicates. Double checked, they are indeed duplicates. I went ahead and selected all the ones I wanted to delete. Typed "prune" - it failed to delete most of it. Re-ran on a sample of 2, to see the error message, it's not very descriptive: Deleted 0 files (occupying 0 bytes); 2 failed.

I checked the permissions, tested with the same user to rm the file, it worked. I'm very confused on why fdupes is failed. I can't find anything to help me understand.

adrianlopezroche commented 1 year ago

It's hard to say what it could be from this bug report. fdupes uses remove() to delete each file, and that can fail for a number of reasons beyond fdupes' control so it's hard to tell without looking at the error code returned by the operating system (which fdupes, unfortunately, does not print out).

Another thing to consider: The latest versions of fdupes will check to make sure that a file's content hasn't changed between the moment the file is scanned and the moment it gets deleted, so if the files can change during execution that would be a possible cause. Running fdupes with --log enabled may help reveal whether this is the case.

sedm0784 commented 1 year ago

I'm getting this error too, for any file I try to remove with fdupes.

Steps to reproduce:

  1. mkdir test && cd test
  2. echo hi > fileA
  3. cp fileA fileB
  4. fdupes -d .
  5. Press shift+right and then shift+left to select fileA for keeping and fileB for deletion
  6. prune

Expected behaviour: fileB should be removed Observed behaviour: Get error: Deleted 0 files (occupying 0 bytes); 1 failed.

  1. Enter exit and then yes to exit fdupes.
  2. rm fileB

Now fileB is deleted.

adrianlopezroche commented 1 year ago

I'm getting this error too, for any file I try to remove with fdupes.

Steps to reproduce:

  1. mkdir test && cd test
  2. echo hi > fileA
  3. cp fileA fileB
  4. fdupes -d .
  5. Press shift+right and then shift+left to select fileA for keeping and fileB for deletion
  6. prune

Expected behaviour: fileB should be removed Observed behaviour: Get error: Deleted 0 files (occupying 0 bytes); 1 failed.

  1. Enter exit and then yes to exit fdupes.
  2. rm fileB

Now fileB is deleted.

I followed this exact sequence of steps and was unable to reproduce the issue. The file 'fileB' is deleted without a hitch on my system. I think it may be helpful to indicate which system you're running this on so that somebody running fdupes under a setup similar to yours might be able to investigate.

sedm0784 commented 1 year ago

Sorry, should have included my system info in my original message: I'm running fdupes 2.2.1 installed via pacman on Arch Linux running on a Raspberry Pi 4. Let me know if there's any more info I can provide to help diagnose the problem.

To be clear, I wasn't expecting the Steps to Reproduce to fail on anyone else's machine: fdupes won't delete any files on my machine, so it seems like something more fundamental is going wrong. I was hoping just to be able to rule out PEBKAC as the issue!