How to retrieve the modification date of a selected file in a command line?

You could use a command like

Rename TO={modifieddate|D#yyyyMMdd}\*

but for your specific case you'll need a script like this:

// https://resource.dopus.com/t/how-to-retrieve-the-modification-date-of-a-selected-file-in-a-command-line/52498

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

    if (!tab) return;
    if (!tab.path) return;
    if (!tab.selected_files.count) return;

    cmd.SetDest(tab.path);

    var cmdLine = 'Copy' +
        ' MOVE' +
        ' COPYFILETIMES=all' +
        ' CREATEFOLDER="{dlgstring|Enter folder name:|' + tab.selected_files(0).modify.Format('D#yyyyMMdd') + ' }"';

    // DOpus.Output(cmdLine);
    cmd.RunCommand(cmdLine);
}
XML
<?xml version="1.0"?>
<button backcol="none" display="label" hotkey_label="yes" label_pos="right" textcol="none">
	<label>52498</label>
	<tip>how-to-retrieve-the-modification-date-of-a-selected-file-in-a-command-line</tip>
	<icon1>#script</icon1>
	<function type="script">
		<instruction>@script JScript</instruction>
		<instruction>// https://resource.dopus.com/t/how-to-retrieve-the-modification-date-of-a-selected-file-in-a-command-line/52498</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) return;</instruction>
		<instruction>    if (!tab.path) return;</instruction>
		<instruction>    if (!tab.selected_files.count) return;</instruction>
		<instruction />
		<instruction>    cmd.SetDest(tab.path);</instruction>
		<instruction />
		<instruction>    var cmdLine = &apos;Copy&apos; +</instruction>
		<instruction>        &apos; MOVE&apos; +</instruction>
		<instruction>        &apos; COPYFILETIMES=all&apos; +</instruction>
		<instruction>        &apos; CREATEFOLDER=&quot;{dlgstring|Enter folder name:|&apos; + tab.selected_files(0).modify.Format(&apos;D#yyyyMMdd&apos;) + &apos; }&quot;&apos;;</instruction>
		<instruction />
		<instruction>    // DOpus.Output(cmdLine);</instruction>
		<instruction>    cmd.RunCommand(cmdLine);</instruction>
		<instruction>}</instruction>
	</function>
</button>

How to use buttons and scripts from this forum