Topic: Is there a way to insert a literal - dash?

This is more of a usage question:

I am using the suggested image renaming pattern for synced renaming of JPG and raw files:

    %e-LiteralText%nc.%e;%f[2]

I would like to rename to something like LiteralText-NNN.*, tried

    %e-LiteralText-%nc.%e;%f[2]

and various variations of escape characters without luck.

Underscore works fine of course,

     %e-LiteralText_%nc.%e;%f[2]

produces expected results of LiteralText_NNN.*

Perhaps this is covered in the help text but I was unable to find it looking for 'literal' and 'escape' words.

Re: Is there a way to insert a literal - dash?

Hello and welcome,

%f[2] : extracts the second array/string element. The default separator is '-' (dash) and this is what causes trouble here.

With the expression you are using : %e-LiteralText-%nc.%e;%f[2]
%f[2] will always give the second string element : LiteralText

I see two ways to solve this :

1) Change the separator
For example lets use '@' in place of the default '-'.
This expression should be ok : %e@LiteralText-%nc.%e;%f[2,"@"]

The first '-' is replaced by '@' : %e@LiteralText
In the second sub-expression, the '@' is specified as separator : %f[2,"@"]

2) Change the extraction
Using the default separator, with the expression : %e-LiteralText-%nc.%e
in fact what we are interested in are the two last elements : LiteralText-%nc.%e

This can be specified by slightly changing the second sub-expression : %f[-2,0]
The extraction is done starting 2 elements from the end (-2) until the end (0).

So, this expression should be ok : %e-LiteralText-%nc.%e;%f[-2,0]

You can see details about this "[]" modifier in the help : Expression/Modifiers/String modifier : "[ ]"

Hoping this will help.

Re: Is there a way to insert a literal - dash?

How about

%e-LiteralText_%nc.%e;%f[2];%f("_","-")

Or some other, non-used sign instead of the underscore.

Re: Is there a way to insert a literal - dash?

Thanks guys, amazing tool - I used Rémi's suggestion 1) above: %e@LiteralText-%nc.%e;%f[2,"@"]
This works in the situation of paired files, like

    IMG001.JPG
    IMG001.RAW
    IMG002.JPG
    IMG002.RAW

so it covers some of my use cases.

Perhaps this thread should be moved to How-To.

Now, the other use case I am trying to solve is where there is not an exact match of JPG to RAW files:

    IMG001.JPG
    IMG002.JPG
    IMG002.RAW
    IMG003.JPG
    IMG003.RAW
    IMG004.RAW

For this case, the above pattern sequences JPG and RAW separately, when the desired outcome is to keep the image pairs together when both are available, and then rename:

    IMG001 (JPG)
    IMG002 (JPG, RAW)
    IMG003 (JPG, RAW)
    IMG004 (RAW)

I realize that this might be a bit of specialized use case, Siren seems otherwise quite capable.

Re: Is there a way to insert a literal - dash?

I am not sure to understand your needs here.
What are the paired files if any ?
Can you give us what you have on input and what you expect on output ?

PS : Thanks to Stefan for the third way to solve the previous issue