Help with using regex to change file names from uppercase to lowercase

Hi everyone,

I am trying to change the uppercase letters in the file names to lowercase using regex but have not succeeded yet. Can anyone give me a hint on how to do so. I have tried using both DEVONthink scripts and smart rules. My filename patterns look like this,


and I want to get:


This is the regex pattern that I look for


for the replacement pattern, I have tried \L\1_\L\2_\3_\4 without any luck.


Is this something you’re going to need to do often?



BSD sed doesn’t support \L.

Here’s a quick method with a little shell thrown into an AppleScript for expedience …

Lowercase (1.1 KB)

1 Like

Thanks, is there any way that I can use regex other than \L?

RegEx isn’t a command. It’s a pattern matching “engine”.

The name change is handled by a different command and it doesn’t support that parameter on macOS’s version of UNIX.

Got you. Thanks.


You’re welcome.

And JavaScript has built-in case functions, so you could choose JS rather than AS after Execute Script,

and in the Edit Script panel, paste or write:

performsmartrule = records => {
    records.forEach(r => { =
} (1.1 KB)


Incidentally, FWIW, those outer braces are redundant in that context, so if it seemed cleaner, it would be fine to just write:

performsmartrule = records =>
    records.forEach(r => { =