Need help with renaming pattern!

Javascript renaming examples. Javascript renaming is supported in version 3 or newer.

Need help with renaming pattern!

Postby marijolisa » Wed Jun 20, 2018 7:07 am

Hi!
I need some direction on how to repeat a sequence of numbers from a filename.
My example:
ab1234.jpg
prefix-item-ab1234-234-dir-x-0001.jpg /
prefix-item-ab1234-234-dir-x-0002.jpg

I'm just looking for number 234 to be recorded from the previous position and added after a (-) into the name.
Is there an easy way to do this?
I appreciate any help!
marijolisa
 
Posts: 4
Joined: Wed Jun 20, 2018 6:11 am

Re: Need help with renaming pattern!

Postby therube » Wed Jun 20, 2018 9:14 pm

Is ab1234 always 6 characters?
Is 234 always the 4th thru 6th characters?
therube
 
Posts: 918
Joined: Mon Jan 18, 2016 6:23 pm

Re: Need help with renaming pattern!

Postby marijolisa » Thu Jun 21, 2018 11:12 am

therube wrote:Is ab1234 always 6 characters?
Is 234 always the 4th thru 6th characters?


Hi @therube,
Yes this is correct.
:) Thanks for your help!
marijolisa
 
Posts: 4
Joined: Wed Jun 20, 2018 6:11 am

Re: Need help with renaming pattern!

Postby therube » Thu Jun 21, 2018 3:36 pm

(I gather you're not telling the whole story, or I'm not understanding enough...)

1:RegEx
Code: Select all
Match: (...)(...)
Replace: prefix-item-\1\2-\2-x-0001
therube
 
Posts: 918
Joined: Mon Jan 18, 2016 6:23 pm

Re: Need help with renaming pattern!

Postby marijolisa » Thu Jun 21, 2018 4:10 pm

Perhaps I'm not explaining myself correctly.

So I have many filenames that have
prefix - is always the same
item - changes in every file
ab1234 - changes in every file
dir-x- stays the same
0001 - numbers ascending

prefix-item-ab1234-234-dir-x-0001.jpg /

Therefore I need the ever changing last three digits of my "ab1234" part of my naming to change depending on the name provided.

prefix-item-ab1234-234-dir-x-0001.jpg /
prefix-item-ab4567-567-dir-x-0001.jpg /
prefix-item-xx4567-567-dir-x-0001.jpg /

and so forth!
I hope it makes sense and thank you!
marijolisa
 
Posts: 4
Joined: Wed Jun 20, 2018 6:11 am

Re: Need help with renaming pattern!

Postby marijolisa » Tue Jun 26, 2018 8:26 am

therube wrote:(I gather you're not telling the whole story, or I'm not understanding enough...)

1:RegEx
Code: Select all
Match: (...)(...)
Replace: prefix-item-\1\2-\2-x-0001


If you are able to look at my reply above and see if there is a way?
marijolisa
 
Posts: 4
Joined: Wed Jun 20, 2018 6:11 am

Re: Need help with renaming pattern!

Postby therube » Fri Jun 29, 2018 3:42 am

Heh, I'm still not getting it.
Throw some more examples out there if you would.

Before
After

Before
After

...
therube
 
Posts: 918
Joined: Mon Jan 18, 2016 6:23 pm


Return to Javascript Renaming