Link files so that one change affects them all

Hi, I can't find the solution through the scrip presets.
My goal is to link file 1 with file 2, so that when I make a change to one of those files, it automatically affects the other.
Example: I copy and paste file 1, automatically file 2 is also copied and pasted.

If this is not possible, it would be useful to be able to make files with similar names but in different directories change if one of them is modified.
Example: File 1 directory A with initial name 123 when copied and pasted, also copy and paste file 2 in directory B with name 1234, regardless of having different extensions (PNG, JPEG). That is, file 2 is copied and pasted by having the initial name with 123, regardless of the extension.

There isn't really a way to do that, at least if you want it to detect every possible action and apply it to the other file as well.

You could make special buttons/hotkeys/events which look at the filename/path (or whichever criteria they need) and do something to a second file at the same time if it matches, but it would only affect those buttons.

Thanks for the suggestion.
So any way to select files in difierentes directories, copy and paste them into your source directories?
When I select one file in the right directory and another on the left and copy and lap, it only copies and pastes the file that is with selected directory.
I'm using the following script:

Copy FILE= {allfile$} TO {sourcepath} RENAMEWHENSAME

Also, when using this script and selecting more than 1 file, instead of copying and pasting file 1 only once, it does so more often. If I select only 1 file, it copies only once normally.

I got a script that works, but I discovered a bug, and I still couldn't solve the problem "Also, when using this script and selecting more than 1 file, instead of copying and pasting file 1 only once, it does so more often. If I select only 1 file, it copies only once normally."

The following script works normally, however if the left view is already enabled, the "toggle" argument does not toggle the view to the right, but if the right view is selected, it switches to the left normally.

Copy FILE= {allfile$} TO {sourcepath} RENAMEWHENSAME
Set FOCUS=Toggle
Copy FILE= {allfile$} TO {sourcepath} RENAMEWHENSAME

So I'm using the following script that works around this bug, but my problem remains (selecting more than one file, copy and paste makes the copy and paste run several times instead of just once)

Set FOCUS=Left
Copy FILE= {allfile$} TO {sourcepath} RENAMEWHENSAME
Set FOCUS=Right
Copy FILE= {allfile$} TO {sourcepath} RENAMEWHENSAME

You shouldn't use {allfile$} with the Copy command. {allfile$} is for running external commands that take a list of file names. The internal Copy command doesn't need it; it copies all the selected files by default.

(The syntax was also wrong there, but that detail isn't important as the FILE argument shouldn't be used at all here. Depending on what you're trying to do, the Copy command may be the wrong thing as well; see below.)

You also almost never need to toggle which side has focus (unless you want to actually change the side that keyboard input goes to). Commands can do things to either side explicitly without changing the focus.

The Copy command is for copying or moving files directly. It isn't for putting things into the clipboard. The Clipboard command does that:

https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Clipboard.htm

If you want to add multiple things to the clipboard from different places, so you can then paste them all at once somewhere, then Clipboard COPY ADD is the command to use. That is like pushing Ctrl-C on some selected files or folders, except it adds to any existing files already on the clipboard.

(You would want to do a normal Ctrl-C or Clipboard COPY for the first file(s)/folders(s), then use Clipboard COPY ADD for any additional items from other places.)

You can also use Collections to build up a list of things that you want to copy or move later on, which is often easier to keep track of than the invisible clipboard.

Or you can use the Copy Queue and just perform the copies/moves on each folder's item as you select them. They don't all have to be done at once, and the subsequent operations will queue up behind the first one (if they're all going to the same destination folder).