How can I remove trailing underscores from file names?

Bulk Rename Utility How-To's

How can I remove trailing underscores from file names?

Postby gwswicord » Mon Apr 22, 2024 2:10 pm

Hi. I have a large set of files that use _ to avoid problems caused by spaces in filenames. How can I remove _ as the last character without removing the underscores between words in the filenames?
gwswicord
 
Posts: 2
Joined: Mon Apr 22, 2024 2:06 pm

Remove ending underscore(s)

Postby Luuk » Mon Apr 22, 2024 7:18 pm

If its always just 1-underscore, Replace(3) can use a "Replace" like \end\_

If can be 1-or-more, then RegEx(1) can use a "Match" and "Replace" like...
(.+?)_+$
\1
Luuk
 
Posts: 709
Joined: Fri Feb 21, 2020 10:58 pm

Re: How can I remove trailing underscores from file names?

Postby gwswicord » Tue Apr 23, 2024 11:51 am

Thanks, Luuk! That did the trick. :)
gwswicord
 
Posts: 2
Joined: Mon Apr 22, 2024 2:06 pm


Return to How-To