Page 1 of 1
Convert Date field in text of Filename
Posted:
Sun Oct 10, 2021 12:00 pm
by GIJS
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.
Re: Convert Date field in text of Filename
Posted:
Mon Oct 11, 2021 1:56 am
by Admin
Hi, can you give a few file name examples, rename from -> to ? thanks
Re: Convert Date field in text of Filename
Posted:
Mon Oct 11, 2021 8:02 am
by GIJS
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
Re: Convert Date field in text of Filename
Posted:
Mon Oct 11, 2021 8:54 pm
by Luuk
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
Re: Convert Date field in text of Filename
Posted:
Tue Oct 12, 2021 4:36 am
by Admin
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.
Re: Convert Date field in text of Filename
Posted:
Tue Oct 12, 2021 8:19 am
by GIJS
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
Re: Convert Date field in text of Filename
Posted:
Wed Oct 13, 2021 2:12 am
by Admin
There are two great
operation manuals written by a BRU user here:
viewforum.php?f=12Very very useful and recommended!
Re: Convert Date field in text of Filename
Posted:
Tue Oct 19, 2021 8:41 am
by GIJS
Thanks very much for the support.
Now I have a lot for selfstudying.
Regards
Gijs