Select files in Destination that START with the filenames in Source

Would a simple script be ok? :wink:

function OnClick(clickData) {
    var cmd = clickData.func.command;
    var tab = clickData.func.sourcetab;
    var dtab = clickData.func.desttab;

    cmd.deselect = false;
    cmd.SetSourceTab(dtab);
    
    cmd.RunCommand('Select NONE');
    
    for (var e = new Enumerator(tab.files); !e.atEnd(); e.moveNext()) {
        var item = e.item();
        cmd.RunCommand('Select PATTERN="' + item.name_stem + '*.*"');
    }
    
    cmd.RunCommand('Select INVERT');
    cmd.RunCommand('Select SHOWFOCUS');
    cmd.RunCommand('Set SOURCE=toggle');
}

Button as XML
<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
	<label>Select Files in Dest</label>
	<icon1>#advancedselect</icon1>
	<function type="script">
		<instruction>@script JScript</instruction>
		<instruction>function OnClick(clickData) {</instruction>
		<instruction>    var cmd = clickData.func.command;</instruction>
		<instruction>    var tab = clickData.func.sourcetab;</instruction>
		<instruction>    var dtab = clickData.func.desttab;</instruction>
		<instruction />
		<instruction>    cmd.deselect = false;</instruction>
		<instruction>    cmd.SetSourceTab(dtab);</instruction>
		<instruction>    </instruction>
		<instruction>    cmd.RunCommand(&apos;Select NONE&apos;);</instruction>
		<instruction>    </instruction>
		<instruction>    for (var e = new Enumerator(tab.files); !e.atEnd(); e.moveNext()) {</instruction>
		<instruction>        var item = e.item();</instruction>
		<instruction>        cmd.RunCommand(&apos;Select PATTERN=&quot;&apos; + item.name_stem + &apos;*.*&quot;&apos;);</instruction>
		<instruction>    }</instruction>
		<instruction>    </instruction>
		<instruction>    cmd.RunCommand(&apos;Select INVERT&apos;);</instruction>
		<instruction>    cmd.RunCommand(&apos;Select SHOWFOCUS&apos;);</instruction>
		<instruction>    cmd.RunCommand(&apos;Set SOURCE=toggle&apos;);</instruction>
		<instruction>}</instruction>
	</function>
</button>

</button>
How to

How to use buttons and scripts from this forum