Can't move files between *.rar archives natively

This script uses a temporary folder to move files and should work just fine with rar archives.

// https://resource.dopus.com/t/cant-move-files-between-rar-archives-natively/39709

// Version 2021-10-30

function OnClick(clickData) {
    var cmd = clickData.func.command;
    var tab = clickData.func.sourcetab;
    var dtab = clickData.func.desttab;
    var fsu = DOpus.FSUtil();
    cmd.deselect = false;

    if (tab.selected.count == 0) return;
    if (!dtab) return;

    var tmp = fsu.GetTempDirPath();

    cmd.RunCommand('Copy MOVE TO="' + tmp + '"');
    cmd.RunCommand('Copy MOVE FILE="' + tmp + '\\*" TO="' + dtab.path + '"');
}
Button as XML
<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
	<label>Move Via Temp</label>
	<tip>Move selected files and folders via a temporary folder</tip>
	<icon1>#move</icon1>
	<function type="script">
		<instruction>@script JScript</instruction>
		<instruction>// https://resource.dopus.com/t/cant-move-files-between-rar-archives-natively/39709</instruction>
		<instruction />
		<instruction>// Version 2021-10-30</instruction>
		<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>    var fsu = DOpus.FSUtil();</instruction>
		<instruction>    cmd.deselect = false;</instruction>
		<instruction />
		<instruction>    if (tab.selected.count == 0) return;</instruction>
		<instruction>    if (!dtab) return;</instruction>
		<instruction />
		<instruction>    var tmp = fsu.GetTempDirPath();</instruction>
		<instruction />
		<instruction>    cmd.RunCommand(&apos;Copy MOVE TO=&quot;&apos; + tmp + &apos;&quot;&apos;);</instruction>
		<instruction>    cmd.RunCommand(&apos;Copy MOVE FILE=&quot;&apos; + tmp + &apos;\\*&quot; TO=&quot;&apos; + dtab.path + &apos;&quot;&apos;);</instruction>
		<instruction>}</instruction>
	</function>
</button>

How to use buttons and scripts from this forum

2 Likes