Renaming abbreviated months

A swapping-ground for Regular Expression syntax

Renaming abbreviated months

Postby tobit » Tue Oct 17, 2017 4:47 pm

I want to rename files where the filename is a date in DDMMMYYYY format to YYYY-MM-DD

For example this:
05Mar2016

to this:
2016-03-05

There are no other characters in the filename. Is there an easy way to do this?
Thanks!
tobit
 
Posts: 2
Joined: Tue Oct 17, 2017 4:19 pm

Re: Renaming abbreviated months

Postby KenP » Wed Oct 18, 2017 3:09 pm

I don't know of an easy or quick way to do this, you would have to do one month at a time.

For instance to rename all the files for March:

Filter (12)
Mask: *Mar*
Now click the refresh button after the Mask text box or just click in any other text box.

When you've filtered the March files:

RegEx (1)
Match: (\d{2})Mar(\d{4})
Replace: \2-03-\1

You could do it without filtering but filtering the files would be my preferred method.

Obviously you would change "Mar" and "03" to whatever month you're renaming.
KenP
 
Posts: 198
Joined: Sat Jul 30, 2016 11:25 am

Re: Renaming abbreviated months

Postby tobit » Wed Oct 18, 2017 7:08 pm

Thanks for the answer! I was thinking of doing it one month at a time but wanted to see if someone might know of a better way.
tobit
 
Posts: 2
Joined: Tue Oct 17, 2017 4:19 pm

Re: Renaming abbreviated months

Postby Admin » Thu Oct 19, 2017 6:53 am

There a way to do all in 1 pass using the JavaScript renaming functionality in BRU but it requires writing a script plus a commercial license. The script would contain the mapping.
Admin
Site Admin
 
Posts: 1504
Joined: Tue Mar 08, 2005 8:39 pm


Return to Regular Expressions