Removing repeated words in file names

Joined
Jan 26, 2020
Messages
3
Reaction score
0
Hi,

I thought this might be a simple, common problem but I've tried searching the forums here and looked at previous posts using google but can't seem to find an answer that helps me.
I have a library of thousands of music files and their corresponding stems some of which have repeated words in their file name.
How can I use automator to remove anything that is a repeated word in the file name?

Before:
tr43-Apocalyptic_Dreams_Stem1_Drums_Stem1_Drums.aiff
tr44-Apocalyptic_Dreams_Stem2_Choir_Stem2_Choir.aiff
tr45-Apocalyptic_Dreams_Stem3_Percussion_Stem3_Percussion.aiff
tr46-Apocalyptic_Dreams_Stem4_Strings_Brass_Stem4_Strings_Brass.aiff
tr133-Apocalyptic_Dreams_30_Second_30_Second.aiff

After:
tr43-Apocalyptic_Dreams_Stem1_Drums.aiff
tr44-Apocalyptic_Dreams_Stem2_Choir.aiff
tr45-Apocalyptic_Dreams_Stem3_Percussion.aiff
tr46-Apocalyptic_Dreams_Stem4_Strings_Brass.aiff
tr133-Apocalyptic_Dreams_30_Second.aiff

TIA
:)
 

Cory Cooper

Moderator
Joined
May 19, 2004
Messages
11,098
Reaction score
500
Hello,

I also have limited experience with AppleScript/Automator. Batch renaming can be done, but gets trickier when there is a repeated set of text, because it looks for the text and replaces it with what you want.

Using your example, you can set it to look for Stem1_Drums, but it will replace both of those with the command you give it. There may be a way to remove duplicate text strings, but that is above my experience level.

I use A Better Finder Rename for batch renaming, which has served me well for years. But, I haven't come across the issue you are having with my files.

Maybe someone over at MacScripter could help.

C
 
Joined
Jan 26, 2020
Messages
3
Reaction score
0
Hello,

I also have limited experience with AppleScript/Automator. Batch renaming can be done, but gets trickier when there is a repeated set of text, because it looks for the text and replaces it with what you want.

Using your example, you can set it to look for Stem1_Drums, but it will replace both of those with the command you give it. There may be a way to remove duplicate text strings, but that is above my experience level.

I use A Better Finder Rename for batch renaming, which has served me well for years. But, I haven't come across the issue you are having with my files.

Maybe someone over at MacScripter could help.

C

Thanks Cory, I've just registered to MacScripter too so hopefully they will approve my account soon and possibly be able to help.

Appreciate your time to reply, I still haven't found a possible solution as yet but I'm sure there is one out there.

Thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top