rename filenames (1989 Feb 3 --> 1989-02-03)

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

rename filenames (1989 Feb 3 --> 1989-02-03)

Postby pavlos » Mon Apr 26, 2010 4:13 pm

Hi all,

I have numerous files with filenames as follows:

1989 Feb 3 Name.mp3
2000 Oct 12 Name.mp3
…

How can I do batch conversion of the filenames to the following format:

1989-02-03 Name.mp3
2000-10-12 Name.mp3
…

In other words to change months and days with two digit number.

regards,
Pavlos
pavlos
 
Posts: 2
Joined: Mon Apr 26, 2010 3:59 pm

Re: rename filenames (1989 Feb 3 --> 1989-02-03)

Postby Stefan » Mon Apr 26, 2010 6:48 pm

Hi Pavlos, welcome

pavlos wrote:Hi all,

I have numerous files with filenames as follows:

1989 Feb 3 Name.mp3
2000 Oct 12 Name.mp3
…

How can I do batch conversion of the filenames to the following format:

1989-02-03 Name.mp3
2000-10-12 Name.mp3
…

In other words to change months and days with two digit number.

regards,
Pavlos



Do 12 times this:

Repl(3)
Replace: " Jan "
With: "-01-"

Repl(3)
Replace: " Feb "
With: "-02-"

Repl(3)
Replace: " Mrz "
With: "-03-"



Then do one time:

RegEx(1)
Match: "(\d\d\d\d-\d\d-)(\d\s.*)"
Replace: "\10\2"


That means for "1989-02-3 Name":
"(\d\d\d\d-\d\d-)" search 4 digits, an dash, two digits, an dash, followed by
"(\d\s.*)" one single digit followed by an blank (so two digits as e.g. '12' will not match here), followed by the rest.

I.e.this regex on "2000-10-12 Name" will NOT match, but on "1989-02-3 Name" will do:
"(\d\d\d\d-\d\d-)" will hold "1989-02-"
"(\d\s.*)" will hold "3 Name"

In replacement, that what is matched by search in first (...) parentheses, can be accessed by "\1", and second (...) by \2
So you can use as replacement \1 followed by an zero digit 0, followed by second capture group content \2, i.e. ====> \10\2

Use all of above without the "quotes".
"..." are used only for explanation.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: rename filenames (1989 Feb 3 --> 1989-02-03)

Postby pavlos » Tue Apr 27, 2010 11:30 am

Thanks a lot Stefan!
pavlos
 
Posts: 2
Joined: Mon Apr 26, 2010 3:59 pm


Return to BRU Support