Reorganizing folder names

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

Reorganizing folder names

Postby RichardV » Tue Jan 16, 2018 4:59 pm

Hello,

I am completely new in this program and in coding. Can I kindly ask you for help in below?
I have list of folders like this - Name Surname 23654 noun
Order of the words is different in each folder, same goes for the numbers and amount of the nouns.
I would like to organize them like this Noun (eight digits number, if in original I miss 8 digits, zeros must be added at the beginning of the number string) Name Surname.
Is this possible to create in JavaScript?

BR
Richard
RichardV
 
Posts: 2
Joined: Tue Jan 16, 2018 4:37 pm

Re: Reorganizing folder names

Postby therube » Tue Jan 16, 2018 5:39 pm

This (not JS) might handle some of it (might need some slight cleanup, like trailing {sp}).

1:RegEx
Code: Select all
Match:  (.* )(\d+ )(.*)
Replace:  \3 \2\1


---

The padding of the number...

Maybe something like, instead of using above, use a similar RegEx, put the number in the first position, then "manually" (visually) look through the list (oh, that's nasty) selecting the ones that need (1, then 2, then 3...) 0's for padding, & use 7:Add to add the needed 0's. Then use yet another similar RegEx to again rearrange things, moving things, with the now padded numbers, into the wanted final order.

---

https://www.google.com/search?q=regex+mask&btnG=Search&rls=org.mozilla%3Aen-US%3Aunofficial&gbv=1
https://www.google.com/search?q=regex+pad+a+number&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:unofficial
therube
 
Posts: 922
Joined: Mon Jan 18, 2016 6:23 pm

Re: Reorganizing folder names

Postby RichardV » Thu Jan 18, 2018 11:11 am

Thank you for help. This was exactly what I was looking for!
RichardV
 
Posts: 2
Joined: Tue Jan 16, 2018 4:37 pm


Return to Javascript Renaming