Rename Dialog sequential Numbering downwards

Can be done easily with a script, if you don't mind it being a standalone button, and also each file (instead of the whole batch) having a separate undo entry:

Try on some disposable test files first, in case it doesn't do exactly what you need.


Script code for reference (contained in the .dcf file above):

function OnClick(clickData)
{
	var pad = 2;

	var cmd = clickData.func.command;
	cmd.deselect = false; // Prevent automatic deselection
	var selected = clickData.func.sourcetab.selected;

	var count = selected.count;
	var current = count;
	var wild = DOpus.FSUtil.NewWild();

	for (var eSel = new Enumerator(selected); !eSel.atEnd(); eSel.moveNext())
	{
		var item = eSel.item();
		var oldPath = wild.EscapeString(item.realpath);
		
		var newName = item.name_stem_m;
		newName += " P" + ZeroPad(current--, pad);
		newName += "_" + count;
		newName += item.ext_m;

		var cmdLine = 'Rename FROM="' + oldPath + '" PATTERN=* TO="' + newName + '"';
		DOpus.Output(cmdLine);

		cmd.ClearFiles();
		cmd.RunCommand(cmdLine);
	}
}

function ZeroPad(s,c)
{
	s = s + "";
	while(s.length < c)
	{
		s = "0" + s;
	}
	return s;
}