Rename a folder with the same name, left and right

Hello :slight_smile:

I have 2 folders, both contain the same tree, with the same folders name.
To work with them, i open one folder on the left, and one on the right, and i have made my own commands :
Create a folder left and right, go back left and right...

Now i want to make a button that is able to rename a folder left and right.
So the button has to select the folder with the same name, on the other side, and rename them.

I wrote this code :

@set name {dlgstring|Entrez le nouveau nom...} set focus=toggle Select DESTTOSOURCE DESELECTNOMATCH rename TO "{$name}" set focus=toggle rename TO "{$name}"

It works well when i am on the right side, but when i launch it on the left, it doesn't !
Can you help me ??

Thanx in advance :slight_smile:

This seems to work, and I've also made it show the current name in the dialog, initially selected, so you can type over it or modify it as needed:

@set name {dlgstringS|Entrez le nouveau nom...|{file$}} Rename FROM {file$} TO {$name} Rename FROM {destpath$}{file$} TO {$name}

Your code is clear and works perfectly, thank you very much :slight_smile:
But i wonder what was wrong in mine ??

As a general rule (there are some exceptions), it's best to avoid things like toggling focus and changing the selection as a method for feeding different files/paths into commands which let you pass them the same paths explicitly, since it doesn't always do what you might expect.