Copy into multiple selected destinations


This script-button copies the selection from the source side in to each selected folder on the destination side.

Before clicking the button:

After clicking the button:


If you download button in .dcf format, you can drag & drop it straight to your toolbars. See near the end of How to add buttons from this forum to your toolbars.

Script code:

Here is the script code, to help those using the forum to find scripting techniques. You do not need to use or understand any of this if you just wish to use the button.

function OnClick(clickData)
	var source = clickData.func.sourcetab;
	var dest   = clickData.func.desttab;
	var cmd    = clickData.func.command;
	cmd.deselect = false; // Leave source files selected.

	if (typeof dest != "object"
	||	dest.selected_dirs.count == 0
	||	source.selected.count == 0)
		clickData.func.dlg.Request("Need selections on both sides.","OK");

	for (var e = new Enumerator(dest.selected_dirs); !e.atEnd(); e.moveNext())
		cmd.AddLine("Copy TO=\"" + e.item().RealPath + "\"");

1 Like