Rename: Replace period(.) with Space

I would like to replace the period(.) in filenames with Space; when it does not appear in between numeric digits.
For Eg:
I would like "Directory.Opus.9.1.txt" to be renamed as "Directory Opus 9.1.txt"

Could someone plz help me with a RegEx for this?

Thanks

Here is Zippo's solution from an older thread:

Type: Regular Expressions
Old Name: b(([^0-9]).|.([^0-9]))(...)#[/b]
New Name: \1\3 \4\5

Or, if you want to make a button instead of using the Rename dialog:

@NoDeselect Rename REGEXP PATTERN="(.*)(([^0-9])\.|\.([^0-9]))(.*\..*)#" TO="\1\3 \4\5"

I'll add this to the Various simple rename presets thread, too.

(The regular expression isn't simple but the idea for what it does is.)

Thanks for this!

Just had a problem with this..
When I rename folders, the last dot in the name is left unchanged.. Probably because of the non existence of extension

Is there a way to fix this?

[quote]Just had a problem with this..
When I rename folders, the last dot in the name is left unchanged.. Probably because of the non existence of extension
[/quote]
Yes, it has been bothering me as well ... among other things about it.
Try this:

Rename REGEXP PATTERN="(.*)(([^0-9])\.|\.([^0-9]))(.*\..*)#" TO="\1\3 \4\5" Rename REGEXP PATTERN="(.*)\.(.*)" to "\1\2" TYPE=dirs

That worked; Thanks!

I can only create a button for this, right!

Rename REGEXP PATTERN="(.*)\.(.*)" to "\1\2"  TYPE=dirs

Or, is there a way to save this as a preset in the "Advanced Rename Dialog"?

Oh really!!! Curious to know what "other things" are there :slight_smile:

Actually, I was hoping both of these could be run in the same button.
Multiple remames in one button have been working well for me in recent versions of Opus until tonight.
It may really be that a script is needed here to accomplish this in one button.

Ohh ... little things that you already see.
What happens to an ellipsis,
such as ... or ...... or .. ,
possibly or possibly not surrounded by space characters ? :smiley:
And can anything be done if a file name ends like .......txt .
And what about Folders ?

[quote] is there a way to save this as a preset in the "Advanced Rename Dialog"?
[/quote]To be honest, I'm not certain at the moment how to do that,
but it is probably easy to do.

[quote="Zippo"]
What happens to an ellipsis,
such as ... or ...... or .. ,
possibly or possibly not surrounded by space characters ? :smiley:
And can anything be done if a file name ends like .......txt .
And what about Folders ?[/quote]
Never came across such names till now.. so everything fine!
and hope not to see them in future too :smiley:

[quote="Zippo"]

[quote] is there a way to save this as a preset in the "Advanced Rename Dialog"?
[/quote]To be honest, I'm not certain at the moment how to do that,
but it is probably easy to do.[/quote]

Okay then, I'll wait until someone else shows...

Thanks for your help!

This should avoid all of the problems with previous examples and folders:

@NoDeselect Rename REGEXP PATTERN="(.*)(([^0-9])\.|\.([^0-9]))(.*\..*)#" TO="\1\3 \4\5" TYPE=files Rename REGEXP PATTERN="(.*)(([^0-9])\.|\.([^0-9]))(.*)#" TO="\1\3 \4\5" TYPE=dirs

If you want to make it a Rename Preset instead of a button it would have to use some VBScript. I'll make an example script later as it seems like a useful thing to have.

Here you go:

[Dots to spaces except in numbers. (For files and folders.))

Took longer to write the post than to write the script. :-/

Thanks for the cool finishing touch :smiley:

After seeing this:

@NoDeselect
Rename REGEXP PATTERN="([0-9][0-9 ] )(.*)" TO="\1- \2"

i figured how to make Regex buttons doing that task, but i can´t find out, what kind of button is needed to simply "find & replace" all "-" with " - " for all selected files, or the like. Can someone help me please? I found that it´s far more convenient having a toolbar with the frequently used renamers than opening the dialog.

The answer is in this post:

[Various simple rename presets - #4 by Leo)

(Find where it says Add spaces around dash (-) characters and collapse multiple spaces: for the relevant part.)

If you've got a working rename preset in the dialog and want to create a button which runs it you can do that very easily:

rename PRESET="Swap Various Artists"

(Where Swap Various Artists is the name of a preset.)

Sometimes it's still good to create a button that doesn't use a preset if you don't want the preset cluttering up the list.

[quote="leo"]

rename PRESET="Swap Various Artists"

(Where Swap Various Artists is the name of a preset.)

Sometimes it's still good to create a button that doesn't use a preset if you don't want the preset cluttering up the list.[/quote]

Thanks! That´s great! I still have some questions. How would the code look for changing all names to first character=upcase, like Ctrl-W would do in rename mode, & how to replace undersores by spaces?

I played around for over an hour & couldn´t figure it out. It would be very nice, if exporting all renames directly to buttons was supported, although it´s already possible to export them to .orp files.

The Rename command has a CASE argument that lets you convert names to upper or lower case in various ways. To make the first letter of each word uppercase you'd just use this:

rename CASE=allwords

For a button that replaces underscores with spaces you could use this:

rename PATTERN="_" TO=" " FINDREP

Add @nodeselect on a separate line to both of them to make it easier to use multiple buttons on the same files.

[quote="leo"]The Rename command has a CASE argument that lets you convert names to upper or lower case in various ways. To make the first letter of each word uppercase you'd just use this:

rename CASE=allwords

For a button that replaces underscores with spaces you could use this:

rename PATTERN="_" TO=" " FINDREP

Add @nodeselect on a separate line to both of them to make it easier to use multiple buttons on the same files.[/quote]

This can be repeated in one function, but here was a little problem

@NoDeselect
rename CASE=allwords
rename PATTERN=" The " TO=" the " FINDREP
rename PATTERN=" Cd " TO=" CD " FINDREP

rejected to change one "The" into "the" in one title, for some reason. Aren´t the lines processed consecutively? For now i use two buttons.