Special rename code sometimes fails

Following code sometimes works, another time the sorting fails.

@nodeselect Select *.jpg Set Columnstoggle=datetaken Sortby=datetaken SORTREVERSE=on @Confirm rename all images?|yes|no Rename PATTERN * TO "[#2] - *" NUMBER

I can abort the operation, if i don't see the correct sorting underneath, of course. Then i can repeat the whole command, & then it mostly works fine. Is there a way to add some "pause" to the command, to give it some extra time to finish the sort?

Relying on asynchronous sorting in the file display to decide rename order won't be reliable.

You could probably do it in two renames. First to rename all the files to include datetaken (using a date format that will sort properly, e.g. yyyy-MM-dd HH-mm-ss). Second to do the numbering as you're doing now (and to remove the dates if they are not wanted).

You might need to do something between the two to force the file order to be re-evaluated. I'm not sure off the top of my head.

Alternatively, it could all be done using scripting, which can get the datetaken metadata for each file and use it to control the order it feeds the files into a rename command.

[quote="leo"]Relying on asynchronous sorting in the file display to decide rename order won't be reliable.

You could probably do it in two renames. First to rename all the files to include datetaken (using a date format that will sort properly, e.g. yyyy-MM-dd HH-mm-ss). Second to do the numbering as you're doing now (and to remove the dates if they are not wanted).[/quote]

Hmm, having datetaken in the filename is not a good option, because i already have tens of thousands of files in the old format.

Yes, that´s what i thought, some asynchronous thing.

Ok, then maybe someone cares to write some script for this. Like i said, it´s no big deal, since i only have to repeat the rename a few times. But it could be some useful script for the scripts collection in Opus.

Just for information, my use case is, that i sometimes take photos using two different cameras. To recreate the original order of the session, i need to sort them by their datetaken EXIFs, having the correct structure like AAAABBAABAABBBAAA (with A & B representing the two cameras), instead of the AAAAAAAAAAABBBBBBBBB type of sorting.

You'd only put it there temporarily, so the files sort in the desired order for numbering. It could then be removed as part of the second rename.

Or do it the normal way and wait until the column's sort arrow changes from red (indicates it is waiting for the data you want to sort on) back to black.

You'd only put it there temporarily, so the files sort in the desired order for numbering. It could then be removed as part of the second rename.[/quote]

This is an interesting idea, but i'm stuck after the first renames. This is, what i have so far:

Select *.jpg Rename FILEINFO PATTERN="*.*" TO="{datetaken} - *.jpg" Set Sortby=name Rename PATTERN * TO "[#2] - *" NUMBER

But i have no idea, how to remove the unwanted part between the numbering & the rear part, containing date plus image number. Also, i wonder if it is some sort of bug, that we have ";" instead of ":" in the time section of {datetaken}, like

30 - 2012-05-25 17;02;11 - 25-Mai-12 - 1234.jpg

No big deal, since it is to be removed anyway, but i'm just asking.

: is used after drive letters. It isn't a valid character in filenames, which is why ; is used in the default time format instead.

A fairly simple wildcard or regexp can remove the unwanted part, but I'm not able to write/test it right now so I can't help with the exact details at the moment.

Ok, thanks, no hurry. The first part worked fine, so far, with my test files. Concerning the thing with the : char, this should have been clear, i didn´t think about that aspect. Obviously i previously never saw minutes & seconds in file names, so that looked really new to me. :smiley: