Convert Date field in text of Filename

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

Convert Date field in text of Filename

Postby GIJS » Sun Oct 10, 2021 12:00 pm

I have a lot of Files with equal Filenames but they differ on one place by a unique Date field: dd-mm-yyyy
How to change that field in the format: yyyy-mm-dd for all the Filenames in one stroke ?
Of course the files should stay unique from each other.
GIJS
 
Posts: 4
Joined: Sun Oct 10, 2021 11:17 am

Re: Convert Date field in text of Filename

Postby Admin » Mon Oct 11, 2021 1:56 am

Hi, can you give a few file name examples, rename from -> to ? thanks
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Convert Date field in text of Filename

Postby GIJS » Mon Oct 11, 2021 8:02 am

OK a few names will do I think:
Portefeuille 09-03-2021 NL07FVLB7000275862.csv
Portefeuille 08-04-2020 NL07FVLB7000275862.csv
Portefeuille 07-05-2021 NL07FVLB7000275862.csv
Portefeuille 01-06-2021 NL07FVLB7000275862.csv

To rename in:
Portefeuille 2021-03-09 NL07FVLB7000275862.csv
Portefeuille 2020-04-08 NL07FVLB7000275862.csv
Portefeuille 2021-05-07 NL07FVLB7000275862.csv
Portefeuille 2021-06-01 NL07FVLB7000275862.csv

My wish is because the automatic ordering by Windows of listed Filenames. A nice feature.
The above group gives a chaotic presentation in the listing.

Thanks for your attention

Gijs
GIJS
 
Posts: 4
Joined: Sun Oct 10, 2021 11:17 am

Re: Convert Date field in text of Filename

Postby Luuk » Mon Oct 11, 2021 8:54 pm

If there is to be only 1-date inside all of the filenames, the Regex(1) can use a Match' and 'Replace' like...
(.*)(?<!\d)(\d\d)(-\d\d-)(19|20)(\d\d)(?!\d)(.*)
\1\4\5\3\2\6

But if some files can have many-dates, its best putting a checkmark in "v2", with a 'Match' and 'Replace' like...
(?<!\d)(\d\d)(-\d\d-)(19|20)(\d\d)(?!\d)/g
$3$4$2$1
Luuk
 
Posts: 690
Joined: Fri Feb 21, 2020 10:58 pm

Re: Convert Date field in text of Filename

Postby Admin » Tue Oct 12, 2021 4:36 am

To add to that, if the name structure is always :

<word><space><date separated by -><space><words>

then you could also use :

RegEx (1)
Match : %1 %2-%3-%4 %5
Replace : %1 %4-%3-%2 %5

Enable option "Simple" in RegEx (1) or it will not work.
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Convert Date field in text of Filename

Postby GIJS » Tue Oct 12, 2021 8:19 am

I was already very content with BRU but now the assistence of your both is most helpful.
I studied for the first time the Help document and was so confused that I couldn't find the solution.
Now your solutions are a help to understand the Help text.
It works indeed!

Thanks
Gijs
GIJS
 
Posts: 4
Joined: Sun Oct 10, 2021 11:17 am

Re: Convert Date field in text of Filename

Postby Admin » Wed Oct 13, 2021 2:12 am

There are two great operation manuals written by a BRU user here:

viewforum.php?f=12

Very very useful and recommended! 8)
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Convert Date field in text of Filename

Postby GIJS » Tue Oct 19, 2021 8:41 am

Thanks very much for the support.
Now I have a lot for selfstudying.
Regards
Gijs
GIJS
 
Posts: 4
Joined: Sun Oct 10, 2021 11:17 am


Return to BRU Support