Select and Rename files

Greetings,
I have for example, files like this :

1789, Les Amants De La Bastille - 13 Les Mots Que L'On Ne Dit Pas (2013).mp3
1789, Les Amants De La Bastille - 13 Les Mots Que L'On Ne Dit Pas (2013).txt
1789, Les Amants De La Bastille - 13 Les Mots Que L'On Ne Dit Pas (2013).lrc

I want to focus one of these files, and push a button to automatically select the 3 files, and rename them thanks to a dialog box.

So i did this :

Select SIMILARBASE 
dopusrt /cmd Rename PATTERN (.*)\.(.*) TO {dlgstring|Nouveau Nom|{file|noext}}.\2 REGEXP
  1. if i don't use the dopusrt external program, it just renames the first file. Why ??
  2. like this it works but it asks me the new name 3 times (one time per file). How to prevent this ??

Thanks for your help :slight_smile:

Mykael

I experienced this some time ago Help with dynamic find and replace button
You can try this

Select SIMILARBASE @set new={dlgstring|Nouveau Nom|{file|noext} Rename PATTERN "(.*)\.(.*)" TO "{$new}.\2" REGEXP

Note that @set trims leading or trailing spaces. As a workaround you could (if you would ever need a leading or trailing space) use a special character for it; example ^ and add Rename PATTERN="^" TO=" " FINDREP to the code. Assuming you don't have that ^ already in your filename. A bit clumsy but does the job. Or learn some scripting :stuck_out_tongue:

I rarelly need spaces at start or end of a file, so it's perfect to me in 99,99% cases, thank you very much OpelOpus :slight_smile:

I resolved my first problem, may be it will help for yours :
I have added the modificator @firstfileonly and it worked perfectly :

@firstfileonly Select SIMILARBASE dopusrt /cmd Rename PATTERN (.*)\.(.*) TO {dlgstring|Nouveau Nom|{file|noext}}.\2 REGEXP

Mykael

Great find! and very creative. Combination of firstfileonly and dopussrt solves my problem as well. :thumbsup:
Thanks.

It's best to avoid DOpusRT in buttons unless you need it, so I'd still go with the version OpelOpus had (unless you need spaces at the start/end, which seems unlikely when it's the whole filename up to the extension being replaced).

:frowning: I didn't know that. Could you extent in short why its best to avoid it?