Find Files and Folders Using a RegEx Name Pattern

Hey Folks,

This macro packages an AppleScriptObjC script that finds files and folders using a regular expression.

Orange Actions are User-Settings – they should be self-explanitory – and should make the macro easy enough for anyone who knows a modicum of RegEx to use.

If not then please ask questions and/or make suggestions.

At present folders can be excluded from the search but not files.

In future I will probably add some features to this critter, but I'm done for the moment.

-Chris


Find Files and Folders Using a RegEx Name Pattern v1.00.kmmacros (14 KB)

3 Likes

@ccstone, this is just what I was looking for! I tweaked it to search using a couple other variables and then open the file. This greatly improves my current solution. Thanks!

1 Like

Hello,

First of all, THANK YOU Chris for the great script!

One question though: I came up with a somewhat elaborate (I guess) RegEx syntax like the following:

^.?\bBounced Files\b.?\bMIXV[0-9]\b.*?\bwav

My purpose would be the following: for a given path, find all ".wav" files whose name contain "MIXV0-MIXV9", inside all subfolders named "Bounced Files".
(I'm a Pro Tools user.)

This syntax doesn't seem OK for the script, whereas it's accepted on regex101.com (and seems to work correctly).
Would you please help me to fix it for the script?
I don't know where to start...

Thanks a lot!

Hey @freewind1974,

My macro above only finds on the file/folder name, so adding a container folder to the regular expression is useless.

To make the macro work in your context you'd need to add a filter to find the container folder name you want.

Something like this:

Find Files and Folders Using a RegEx Name Pattern v1.50.kmmacros (19 KB)

Notice that I've added a variable local_FolderNameFilter containing the literal text /Bounced Files/

You could use a regular expression for that, but in this case it's not necessary.

See the added actions below the disabled DEBUG ⇢ Display Text action.

-Chris

Thank you for answering, Chris!
It's not working at the moment, but I'll figure out what's happening.

Thanks for the help,
Lorenzo