Multiple file and inline rename

Yes I know about batch and advanced rename. But they are way too many clicks for what I'm seeking.

Explorer has one really nice feature DO doesnt. Inline rename of multiple files.

Imagine we have
file.mpg
file.srt.

if I select both, then F2 and rename it to Foo, I will end up with Foo.mpg and Foo.srt. With DO, only one file gets renamed.

When same extension such as:
file1.jpg
file2.jpg
file3.jpg

And if I rename it to Foo, Explorer will rename them as:
Foo (1).jpg
Foo (2).jpg
Foo (3).jpg

DO just renames the first file.

You could make a simple buttons that does the same thing with the same number of clicks in Explorer, if it's something you do a lot.

Although it isn't many more clicks, for a far more powerful interface, to open the Rename dialog and then start typing into the New Name column, which will edit all of the file names at once. (Assuming the option above the preview list is turned on.)

Simple tasks should not require MORE clicks. In Explorer its a simple F2, done. I don't see any reason NOT to add this in DO. Why would anyone purposefully select a bunch of files, press F2, and expect only the first one to be renamed? This is really simple functionality. I cant imagine any user saying that they want it to work this way - especially when Windows Explorer works much better in this one specific case.

Also (if this doesnt exist arleady), a button/menu to "launch Windows Explorer here" would be nice. Similar to the Powershell here (not sure if this is DO or Windows). Yes, I know I can add it, but I think this is something that should be built in.

There’s not really any reason to add it either. It’s a pretty hidden feature in Explorer which I’d say not many people know about, and we have far more powerful rename functionality which we’d prefer people to use.

But your functionality requires far more user input for a simple task. And will it rename files with same extensions as (1) (2), or is that going to require option setting etc?

Since it is so simple to implement, why not implement it? And if not, why let F2 work at all with multiselect currently since it only renames the first file?

I just dont see why you would willfully break with functionality of Explorer that is simple to do, effective, and won't break anything in DO.

Its well known feature and especially given that DO caters to power users, I dont think you should be so dismissive of it.

https://support.microsoft.com/en-us/help/320167/how-to-rename-multiple-files-in-windows-xp-with-windows-explorer

Change your F2 hotkey to run this JScript:


  • A newer version of this script is below. Aug/2018.

function OnClick(clickData)
{
	var cmd = clickData.func.command;
	var selected = clickData.func.sourcetab.selected;
	var count = selected.count;

	if (count == 0)
		return;

	if (count == 1)
	{
		cmd.RunCommand("Rename INLINE");
		return;
	}

	var dlg = clickData.func.Dlg();
	dlg.title = "Rename - Directory Opus";
	dlg.message = "Enter new name for all " + count + " items:";
	dlg.buttons = "&OK|&Cancel";
	dlg.max = 0;
	dlg.defvalue = selected(0).name_stem_m;
	dlg.icon = "question";
	dlg.select = true;

	if (dlg.Show() != 1)
		return;

	var newName = String(dlg.input);

	if (newName == "")
		return;

	newName = newName.replace(/"/g, "'");

	var cmdLine = 'Rename AUTORENAME IGNOREEXT PATTERN="*" TO="' + newName + '"';

	cmd.RunCommand(cmdLine);
}

Now Opus will behave like Explorer.

Or you can make it do a million other things if you don't want that one particular thing Explorer does.

That's the beauty of Opus. And with more flexibility sometimes comes the need to set things up, but copying the above script into your F2 hotkey will only take you a few seconds.

EDIT: Slight correction to the line that replaces " with '.

1 Like

Yes, Im glad for the expandabilty. But I believe that out of the box, DO unless it is fixing or improving on explorer should function otherwise similar as a user would expect.

I can use this but then its just one more thing I have to worry about backing up and restoring between Windows reinstalls.

Has anyone ever asked for DO on F2 to rename the first file only?

Is this a feature to rename only the first file? Are there any users you believe who are better served by having F2 only rename one file instead of how Explorer has since at least XP?

Why do it differently than explorer which does it far better?

I can understand the resistance if the feature required a lot of code (which obviously it does not), or if somehow DO improved on F2 - but it doesn't even match explorer let alone improve on it for inline renames.

In short - is there any reason not to add this as a feature in DO directly? Is anyone honestly going to say "I missed it when it only renamed the first file!"?

And your code does *, which wont work unless its also taking into account the files I have selected (on simple visual inspection it does not appear to). They cannot be wildcard selected and I must manually select the files I want to consolidate into a single name prefix.

As it is its easier if I use Explorer and that should not be the case. Worse yet, the opened folders are opened by another EXE, so I cant even tell it to use Explorer if I want to have DO as the default explorer.

Via Ctrl-3 its at least 3 clicks more vs a single F2 in explorer. And even then I end up with Foo1, Foo2 instead of Foo (1) Foo (2) which is another problem because often the file name I need to use is a numeric ID. So if I need to rename them 456654, I now get 4566541, 4566542, 4566543 instead of 456654 (1), 456654 (2), 456654 (3)

You asked for it to be added. We just added it for you. :slight_smile: We might change the default config as well (need to think on that a bit first), but for you the problem is surely solved now?

You presumably have made other changes to your Opus configuration, so if you are worried about Windows reinstalls, use Settings > Backup & Restore to save a config backup. That solves not just worrying about this, but every other change.

It uses * as the PATTERN argument. That make it rename all selected items. What is the problem there? Have you tried the script or are you just guessing that it won't work from looking at it?

I have tested the script and it works fine as far as I can tell. Let me know if you find a problem.

Not sure what this means. Which other exe? Why are the folders opening in something else? What are you doing here? I'm confused.

Why are you using Ctrl-3? I said to put the script on your F2 hotkey. It will replace the meaning of F2 and then function like Explorer, with exactly the same number of clicks.

Have you actually tried the script I just wrote for you and posted? It will name things "Foo (1)", "Foo (2)", etc. just as you asked.

Please try the solution I offered before pointing out theoretical problems!

(If you want the same renaming in the Rename dialog, turn on the Automatically rename if new filename exists option. That's what the AUTORENAME argument in the script is doing.)


To clarify, with the script on your F2 hotkey:

  • Pushing F2 with one file/folder selected will inline-rename just that file/folder, as before.

  • Pushing F2 with more than one file/folder selected will ask you for the name you want, then apply that name to all selected files/folders, keeping their existing extensions and renaming with "... (1)", "... (2)", etc. if there is a clash.

1 Like

I've been using the script above to see if any problems arise from it, with a view to potentially making it the new default.

One problem I ran into is that it breaks F2 to rename items in the folder tree.

This is fixed in the version below.

The new part is the if (cmd.IsSet("focus=tree")) { ... } block near the start.

It requires 12.9.2 beta or above.

function OnClick(clickData)
{
	var cmd = clickData.func.command;

	if (cmd.IsSet("focus=tree"))
	{
		cmd.deselect = false;
		cmd.ClearFiles();
		cmd.RunCommand("Rename INLINE");
		return;
	}

	var selected = clickData.func.sourcetab.selected;
	var count = selected.count;

	if (count == 0)
		return;

	if (count == 1)
	{
		cmd.RunCommand("Rename INLINE");
		return;
	}

	var dlg = clickData.func.Dlg();
	dlg.title = "Rename - Directory Opus";
	dlg.message = "Enter new name for all " + count + " items:";
	dlg.buttons = "&OK|&Cancel";
	dlg.max = 0;
	dlg.defvalue = selected(0).name_stem_m;
	dlg.icon = "question";
	dlg.select = true;

	if (dlg.Show() != 1)
		return;

	var newName = String(dlg.input);

	if (newName == "")
		return;

	newName = newName.replace(/"/g, "'");

	var cmdLine = 'Rename AUTORENAME IGNOREEXT PATTERN="*" TO="' + newName + '"';

	cmd.RunCommand(cmdLine);
}

In the next update (12.10.3) we'll add an option to make Opus work the same way as Explorer in this respect (without needing a script).

Here are three examples of people not wanting that, fwiw.

Hi.

Does F2 "rename all selected files at once" only work in details/power? In list or thumbnails mode, F2 only seems to affect the last clicked item (highlighted by a thin box) rather than the selection.

If you need to batch rename a lot of image files without filenames, you need either thumbnails or preview panel so the advanced renamer isn't suitable.

Thanks.

It works fine in all modes here.