keeping only last n of characters

Post any Bulk Rename Utility support requirements here. Open to all registered users.

keeping only last n of characters

Postby chad_thompson » Thu Nov 19, 2009 8:35 pm

Is there a way I can rename a file to keep, say only the last 5 characters of the filename?

example: if I have abcdefg_85101.jpg, and I have 985101.jpg

and I just want to keep the 85101 in both of them?

Thanks,
Chad
chad_thompson
 
Posts: 2
Joined: Thu Nov 19, 2009 8:26 pm

Re: keeping only last n of characters

Postby Admin » Fri Nov 20, 2009 6:39 am

Hello

Under remove there is an option to crop before a char

thanks
Admin
Site Admin
 
Posts: 2354
Joined: Tue Mar 08, 2005 8:39 pm

Re: keeping only last n of characters

Postby chad_thompson » Fri Nov 20, 2009 7:31 pm

Hi,

thanks for the reply. I cannot remove/crop before a certain character, as each filename is vastly different. the only solution I've found is to sort by length, and then highlight the ones with the same length, and remove all but the last 8 characters.
chad_thompson
 
Posts: 2
Joined: Thu Nov 19, 2009 8:26 pm

Re: keeping only last n of characters

Postby Stefan » Fri Nov 20, 2009 10:56 pm

chad_thompson wrote:Is there a way I can rename a file to keep, say only the last 5 characters of the filename?

example: if I have abcdefg_85101.jpg, and I have 985101.jpg

and I just want to keep the 85101 in both of them?

Thanks,
Chad


You can use RegEx(1)
Match: .+(.{5})
Replace: \1

Explanation:
.+ => first, find one or more of any char
.{5} => after then, match 5 peaces of any char
( ) => group for back reference
\1 => use content of group No.1 (we have only 1 group,but there could be more, and in group 1 are the last 5 chars)
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU


Return to BRU Support