Kill text words of a long folder name

Hi again,

I was hoping to get some help on renaming (truncating) long folder names. I looked at DO's standard renaming functions and dynamic renamer but still have no clue on how to perform this task. Here is what I'm hoping to accomplish:

Existing Folder Names:
John and Jane Smith Hawaii Vacation 5-14
Leroy Doe holiday party 1-13
Max Elliott Boos birthday party 6-13
Jill Wilson Orlando Conference 8-14

Rename (truncated) Folder Names:
John and Jane Smith
Leroy Doe
Max Elliott Boos
Jill Wilson

I was hoping to find a way to kill any text words of a folder name after selecting the first number of text words I wanted to retain. For example, I want to retain the first two, three, etc. words of a folder name and truncate the rest. The words are always separated with spaces if that matters. I have been performing this task manually one by one and at times the folder names can be quite lengthy. I realize that whatever method is presented, I can only truncate text words of a folder name(s) selected if I wanted to retain the first two words as an example. Then select folders that I wanted to retain the first three text words, etc. I hope all this makes sense.

As always, any help would be greatly appreciated.

It's easy enough to define "words" using regular expressions. How will you know in advance if you want to preserve two or three words? If you are going to work in groups, where you first work on the two word folders, and then later the three word folders, etc., that can be done.

Hi MrC,

Yes, I would be working in groups as you described.

Regular expression rename to eliminate the first two words:

Old name: (\S+\s+){2}(.*)
New name: \2

Change the {2} to a {3} to kill 3 words.

Hi MrC,

I'm sorry I may not have correctly stated this. I am looking to preserve the first two or three words in the file name and kill any words to the right of them.

You were clear; I didn't read well.

Old name: ((?:\S+\s+){2}).*
New name: \1

Works beautifully! Thank you Mrc.