marcusbuffett / pipe-rename

Rename your files using your favorite text editor
https://crates.io/crates/pipe-rename
MIT License
396 stars 12 forks source link

Found an issue when renaming overwrites existing file #75

Open assarbad opened 1 year ago

assarbad commented 1 year ago

I tried to rename a number of .epub files. Seven to be precise.

In the course of renaming, I changed one existing file to another name and gave a new file that previous name. So essentially I had something like (condensed to two files):

ABC -> ABC1
BCD -> ABC

It complained that the renaming of BCD to ABC would overwrite existing files.

There were two issues with that:

  1. it didn't include all renames performed
  2. it wrongly concluded that the renaming of BCD to ABC would overwrite the file which -- in the same renaming session -- had been reassigned the name ABC1

Here's the actual output:

$ renamer *.epub

The following replacements overwrite existing files:
Циолковский Константин. На Луне - royallib.com.epub -> На Луне (Константин Циолковский).epub

Execute these renames?: Yes
mtimkovich commented 1 year ago

Thanks for the report! That doesn't surprise me because the existing files check only checks the state of things before the renames.

Edit: Re your first bullet: that's an easy fix, I need to have it print all renames in the case that there are conflicts.

mtimkovich commented 6 months ago

This also causes the problem where --undo doesn't undo the affected files because it doesn't realize the conflict.