Inline renaming: replace Invalid characters ("\\/:*?\"<>|") with underscore _

when I inline renaming with the F2 shortcut,

using a slash ("/") in a file name typically triggers its interpretation as a path separator, meaning it creates a folder structure. when I rename the file to "baking UV textures (2/3)"
it results in undesirable results.

instead, I want to default to replacing Invalid characters ("\/:*?"<>|") with underscore _
is that possible?

1 Like

In Directory Opus, inline renaming (initiated by pressing F2) doesn't automatically replace invalid characters like the forward slash (/) with an underscore (_). Instead, entering a / is interpreted as a path separator, which can inadvertently create new folders. Unlike Windows File Explorer, which removes invalid characters or displays an error, Directory Opus lacks a built-in feature to handle this during inline renaming.

I'm requesting this as a feature as a toggle to parity windows explorer

1 Like

clarification for my use case:

I want to do this quickly, I'm downloading youtube videos and I'm quickly renaming the resulting "19825892.mp4" file to the name of the video on youtube, which can be a very long name. I will miss the hidden "/" when copying over the name. which results in my problem.

this wouldn't be a problem in the first place If I can see the slash and manually replaced it before hand. I simply want this to be automated so I can mindlessly copy and paste the video name.

the file cannot have "/" in its name to begin with, so the rename function in Dopus cannot possibly replace the invalid character.

No please, I don't want that. It's very convenient to be able to rename a file so it goes into a subfolder by entering / in its new name.
Plus this will break already existing renaming patterns based on this behaviour.

"I'm requesting this as a feature as a toggle"
the toggle will be enabled by default so Directory Opus default behavior will be preserved.

I just want the feature to be toggleable
thank you for your understanding -J

This could be achieved by using a custom button which treats what's in the clipboard before proposing the rename.

Here's one I recently made for a similar issue where I have a : in the name I want to copy :

@nodeselect
@evalalways:=clip = Clip(); myNN = Replace(clip, ":", " -"); 
@Set targetName="{dlgstring|Target Name|{=myNN=}}"
Rename PATTERN * TO {$targetName} IGNOREEXT

It displays the new name for editing before doing the rename, which could be skipped if you want a faster action and you're sure of what you're doing.

1 Like

Usually a good place to start before asking for new features is by linking your account :slight_smile:

I don't think you can change the default but you can define a hotkey via Preferences / File Operations / Renaming Files / Control Keys and implement any replacement you like.

1 Like