Folder listing with precalculated sizes exported to txt files without recalculation

You can use a script to copy the info to the clipboard. Size will be zero, if it hasn't been calculated.

// https://resource.dopus.com/t/folder-listing-with-precalculated-sizes-exported-to-txt-files-without-recalculation/42600

// 2022-10-25

function OnClick(clickData) {
    var cmd = clickData.func.command;
    var tab = clickData.func.sourcetab;
    cmd.deselect = false;

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

    var tmp = '';
    for (var e = new Enumerator(tab.selected); !e.atEnd(); e.moveNext()) {
        var item = e.item();
        tmp += item.name + '\t' + item.size + '\r\n';
    }
    DOpus.SetClip(tmp);
}
Button as XML
<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
	<label>Name+Size</label>
	<tip>Copy Filename+Size to Clipboard</tip>
	<icon1>#copyfilenames</icon1>
	<function type="script">
		<instruction>@script JScript</instruction>
		<instruction>// https://resource.dopus.com/t/folder-listing-with-precalculated-sizes-exported-to-txt-files-without-recalculation/42600</instruction>
		<instruction />
		<instruction>// 2022-10-25</instruction>
		<instruction />
		<instruction>function OnClick(clickData) {</instruction>
		<instruction>    var cmd = clickData.func.command;</instruction>
		<instruction>    var tab = clickData.func.sourcetab;</instruction>
		<instruction>    cmd.deselect = false;</instruction>
		<instruction />
		<instruction>    if (tab.selected.count == 0) return;</instruction>
		<instruction />
		<instruction>    var tmp = &apos;&apos;;</instruction>
		<instruction>    for (var e = new Enumerator(tab.selected); !e.atEnd(); e.moveNext()) {</instruction>
		<instruction>        var item = e.item();</instruction>
		<instruction>        tmp += item.name + &apos;\t&apos; + item.size + &apos;\r\n&apos;;</instruction>
		<instruction>    }</instruction>
		<instruction>    DOpus.SetClip(tmp);</instruction>
		<instruction>}</instruction>
	</function>
</button>

1 Like