Maintain state during move and copy of multiple files.
When selecting and moving several versions of the same image, spurious error messages are raised on every version moved after the first, since the call to the move function on the first version automatically moves all.
Also, the copy function exhibits the following incorrect behavior when the given destination file already exists:
When copying, e.g., image
A/Image.jpg into directory
B/Image.jpg already exists, the copy function will not overwrite
B/Image.jpg, but will create a new version of
A/Image.jpg in the database in filmroll
B (and a new sidecar
B/Image_01.jpg.xmp) erroneously linked to the potentially unrelated
Since the move and copy functions operate over only one image at a time, it is impossible, within them, to distinguish between the first version of an image moved/copied and subsequent versions. Some form of external state must be maintained that allows implementation of the following behavior:
- Call the move function only on the first version of an image encountered, and not on subsequent versions.
- When calling the copy function on the first version of an image encountered, always raise an error if the destination file already exists. Call on subsequent versions only if the copy on the first version succeeded, and do not raise any errors if the destination file already exists in that case.