Hi guys, I hope you can help me with some interesting rename patterns. Here's my request.
1. Clean multiple spaces or underscores.
I found this awesome scripts in this thread Various simple rename presets which does just fine, except that it doesn't remove a space at the end. And it would be great if it would affect both underscores and spaces. Integrated with the Underscores to spaces preset.
How__to___rename.txt
How to rename.txt
2. Seperate words by recognizing cases. (even if the first word does not start with a case)
howToRename.txt
How To Rename.txt
3. Make only extension lowercase. I have the preset called Capitilize words but it also effects filename before the file extension.
How to RENAME.TXT
How to RENAME.txt
4. Find specific character and replace (in this example: find the second dot and replace with a space+dash)
1.04. How to rename.txt
1.04 - How to rename.txt
5. I figured out the following example, but that is as far as I got. (.+)-(.+)(.[^.]+) to \1\3
How to rename-1.txt
How to rename.txt
It would be awesome to have these as presets. And I'm sure more people would benefit from such presets. Thanks in Advance.
Just for fun, in addition to abr's suggestion: here are some regexes you can save as presets.
How__to___rename.txt => How to rename.txt
Regex mode
Old name: *([^]+)_+(.*)#
New name: \1 \2
No need to check any of the boxes
howToRename.txt => 02. How To Rename.txt
Regex mode
Old name: (.?)([a-z]+)(?=[A-Z])(.)#
New name: \1\2 \3
Check the "Case Sensitive" and "Modify Capitalization: Capitalize all words" boxes
How to RENAME.TXT => How to RENAME.txt
Regex mode
Old name: (.*)
New name: \1
Check the "Modify Capitalization: Lower-Case Extension" box
1.04. How to rename.txt => 1.04 - How to rename.txt
Since you want to replace "specific characters", you will need some knowledge of regex to adapt the saved pattern for every case.
Regex mode
Old name: ([^.]+).([^.]+).(.*)
New name: \1.\2 -\3
No need to check any boxes.
How to rename-1.txt => How to rename.txt
Regex mode
Old name: (.*)-\d(.[^.]+)
New name: \1\2
No need to check any boxes.
Thank you very much guys. Really appreaciate your help.
@MrC. That looks like a powerful tool! I installed activePerl than I placed the orp file in Appdata under rename presets, but it doesn't show up. Should I do something in ActivePerl first?
@Playful
Example 1 still doesn't remove a space at the end. And is it possible the same rule addresses both multiple underscores and spaces?
Example 2 did not work for me.
Example 4. "Since you want to replace "specific characters", you will need some knowledge of regex to adapt the saved pattern for every case."
Thats indeed the difficult part. Is there a way to just address the 4th character with regex? Say if I just want the 4th character and replace it with x?
No, just import the orp via the Rename dialog, File > Import.[/quote]
Yes that worked. Brilliant! Especially for example 2, I thought that one was pretty though. Thank you so much! Im going to study this Dynamic Renamer and see if I can use it without help in the future.
On your first screenshot, please note that you said you wanted to replace the fourth character with x:
Your original filename already contains "x" as the fourth character, so there is no change (x is changed into x). To change the fourth character to "y" in the file name, change the x to a y in the replacement string:
\1y\2
For your second screenshot... I must have been asleep when I wrote to you (first thing in the morning). I was missing one character. Please see attached screenshot.
^*([^]+)+(.*?)*(.[^.]+)#
\1 \2\3
For your last screenshot... It beats me. Please have a look at the "comp" screenshot below. Do you see any difference? I don't think I see one. A good question for someone with keener eyes. Maybe we're missing a setting somewhere.
Or could it be that one of the characters in your file name is some unicode character that looks exactly like ascii but is not ascii? That can happen with foreign locales. To give you an example, there are several ways to encode "é".
But no worries. For now I'll use MrC's dynamic rename. Im really grateful for your time and help. Great community!
Im planning on upgrade when opus 11 releases, so maybe then I get to play with new regex and more stuff.
@OpelOpus - I'm glad you like the tool. I find it very useful, and use it frequently. It is pretty easy to build up very complex renames with a few simple chained options.
Yesterday I solved part 1 of a long-standing problem, and just a few minutes ago I solved part 2:
These fixes will go into a new version of Dynamic Renamer, which I'll put out tomorrow. In a nut shell, the fixes will allow certain tricky Unicode characters to be processed by Directory Opus correctly (the thread above mentions the character "ţ" (latin small t with cedilla), which in your version of Dynamic Renamer will get treated as a "t" (small t).