Page 1 of 1

Rename DD-MM-YYYY to YYYY-MM-DD

PostPosted: Tue Jun 16, 2015 5:51 am
by ryanvo1991
Hi all,


I have hundreds of files that I need to change the date format to. They are currently set as DD-MM-YYYY and I need to change them to YYYY-MM-DD


For example I want to change

01-02-2015

TO

2015-02-01

Any help would be appreciated.

Thank you!

Swap reorder rearrange date time parts DD-MM-YYYY

PostPosted: Tue Jun 16, 2015 6:42 am
by Stefan
The solution depends of your whole file name (not only the date part) as BRUs RegEx only work on the whole name.


For just the date part it would be:

FROM/ORIGIN:
DD-MM-YYYY
01-02-2015

TO/WANTED:
YYYY-MM-DD
2015-02-01

use
RegEx(1)
Match: (\d\d)-(\d\d)-(\d\d\d\d)
Repla: \3-\2-\1



EDIT: forgot a hyphen to add.

Re: Rename DD-MM-YYYY to YYYY-MM-DD

PostPosted: Tue Jun 16, 2015 6:50 am
by ryanvo1991
Thank you for your reply!

Each file has a different name though. Different in length. The only part I need to change is the date part of it?

Would this still work?

Re: Rename DD-MM-YYYY to YYYY-MM-DD

PostPosted: Tue Jun 16, 2015 7:18 am
by Stefan
ryanvo1991 wrote:Each file has a different name though. Different in length.

Of course.
But that doesn't matter, as long as you (or we) can find a common pattern.
For example, you could match everything before and after the date by just (.+)(\d\d)-(\d\d)-(\d\d\d\d)(.+)
Only you have to recount the capture groups after that and adjust the replacement too, as here to: \1\4-\3-\2\5

All depends on your real file names.

ryanvo1991 wrote:Would this still work?

No, BRUs RegEx engine works only on the whole file name, not on parts only.
(Example here: http://www.bulkrenameutility.co.uk/forum/viewtopic.php?p=6477#p6477 )

If you don't match and capture the other parts too, you won't have them in the output.



.