Bug 382811 - Sometimes reordering is needed for batch rename to succeed
Summary: Sometimes reordering is needed for batch rename to succeed
Status: REPORTED
Alias: None
Product: digikam
Classification: Applications
Component: AdvancedRename-metadata (show other bugs)
Version: 5.8.0
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-27 16:50 UTC by Anton Lavrov
Modified: 2022-02-01 06:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for reordering of rename operations (24.46 KB, patch)
2017-07-27 17:03 UTC, Anton Lavrov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Lavrov 2017-07-27 16:50:04 UTC
E.g. I want to rename files:

  1.jpg => 2.jpg                                                                                                   
  2.jpg => 3.jpg                                                                                                   

If rename operations are performed in this order, batch rename will fail at the first step because file 2.jpg exists. However if Digikam changes order of rename operations to:

  2.jpg => 3.jpg                                                                                                   
  1.jpg => 2.jpg

then batch rename will succeed.
Comment 1 Anton Lavrov 2017-07-27 17:03:55 UTC
Created attachment 106896 [details]
Patch for reordering of rename operations

Attached a patch to support reordering of rename operations.

Two major changes here:

1. Now when checking conflicts with existing files before starting batch rename, Digikam takes into account renamed files. E.g. before following rename sequence was not allowed because Digikam checked that name 2.jpg exists before starting the rename:

  2.jpg => 3.jpg                                                                                                   
  1.jpg => 2.jpg

Patched version will take into account that file 2.jpg will be already renamed to 3.jpg, so there will be no obstructions for renaming 1.jpg to 2.jpg, and will allow this scenario.

2. Digikam will do necessary reordering of rename operations - e.g. it will change this sequence:

  1.jpg => 2.jpg                                                                                                   
  2.jpg => 3.jpg                                                                                                   

to:

  2.jpg => 3.jpg                                                                                                   
  1.jpg => 2.jpg