FilippoRanza/rmd

delete a duplicate that is deeper

whoizit opened this issue · 2 comments

the current algorithm is deleted differently. But you should prefer to delete a duplicate that is deeper.
In my case, half the files were left in one directory, half in another.

$ rmd -drcvv /home/
Remove File: "/home/d/q/RDS MAX Natural/txt/Text/Text/5_Ustanovki_Maxa_dlya_perioda_spada.pdf" - freed 886.29 kb
Remove File: "/home/d/q/RDS MAX Natural/txt/Text/Text/4_Ustanovki_trudovoy_etiki_Maxa.pdf" - freed 928.14 kb
Remove File: "/home/d/q/RDS MAX Natural/txt/Text/Text/2_Ustanovki_Maxa_na_Igru.pdf" - freed 386.08 kb
Remove File: "/home/d/q/RDS MAX Natural/txt/3_Glavnye_ustanovki_Maxa.pdf" - freed 379.07 kb
Remove File: "/home/d/q/RDS MAX Natural/txt/6_Spisok_knig_ot_Maxa.pdf" - freed 5.34 Mb
Remove File: "/home/d/q/RDS MAX Natural/txt/1_Pervye_ustanovki_Maxa.pdf" - freed 397.25 kb

I'm sorry for the mess. Probably I figured out which is the problem, the algorithm to recursively search files implements a BFS on the file system tree and it calls itself recursively as soon as it encounters a directory in the file listing. This naive implementation should be the cause of your issue. I'll fix it as soon as possible

Now the algorithm that search files implements a real breadth-first search, checking each file in a directory before moving into a subdirectory. This allows rmd to correctly identify deeper files as duplicates.