Moving Date in File Name

A swapping-ground for Regular Expression syntax

Moving Date in File Name

Postby Andy1982 » Fri Nov 04, 2016 1:38 pm

Hi,
I have the following problem:
I have most of my files named YY MM DD FILENAME and I want to pass most of them to the Format FILENAME_YYYY_MM_DD.
The FILENAME is always different, may contain numbers, dahes etc

As an example:

16 05 07 Protocol V7_rev3 -> Protocol V7_rev3_2016_05_07

Thanks for your help!

Andy
Andy1982
 
Posts: 2
Joined: Fri Nov 04, 2016 1:24 pm

Re: Moving Date in File Name

Postby KenP » Fri Nov 04, 2016 2:16 pm

If all your files are dated since the year 2000 this will do what you want.

RegEx (1)
Match: ^(\d{2}) (\d{2}) (\d{2}) (.*)
Replace: \4_20\1_\2_\3

If there are files dated before the year 2000 it may help you if you filter the files in "Filters (12)" before selecting and renaming them, for files dated before 2000 change the 20 in "Replace" to 19 before renaming them.
KenP
 
Posts: 199
Joined: Sat Jul 30, 2016 11:25 am

Re: Moving Date in File Name

Postby Andy1982 » Fri Nov 04, 2016 2:51 pm

Great, thanks so much!!
Andy1982
 
Posts: 2
Joined: Fri Nov 04, 2016 1:24 pm


Return to Regular Expressions