How to move parts of a filename

Advanced Renamer forum
#1 : 18/11-17 11:55
Axel
Axel
Posts: 6
Hi,

after a download I have filenames like

subject_CustomerNumber_day-month-year_Number.pdf

I want to change it to

Year-Month-Day Subject-Number.pdf



18/11-17 11:55
#2 : 18/11-17 19:34
Stefan
Stefan
Posts: 274
FROM:
subject_CustomerNumber_day-month-year_Number.pdf
TO:
Year-Month-Day Subject-Number.pdf


Use two times a Replace method with regular expressions:
https://www.advancedrenamer.com/user_guide/metho d_replace
https://www.advancedrenamer.com/user_guide/regul ar_expresions


- - -

--- STEP 1
Find all till first , second and third underscore, and then the rest:
^(.*?)_(.*?)_(.*?)_(.*)$

The matches can be recalled by \1 \2 \3 \4 meta character.
\1 subject
\2 CustomerNumber
\3 day-month-year
\4 Number
Just use the wanted new order in the replacement:
\3 \1-\4

Text to be replaced: ^(.*?)_(.*?)_(.*?)_(.*)$
Replace with: \3 \1-\4

You get:
day-month-year subject-Number.pdf

- - -

--- STEP 2
Do now the same to reorder the date:

Text to be replaced: ^(.*?)-(.*?)-(.*?) (.*)$
Replace with: \3-\2-\1 \4

You get:
Year-Month-Day Subject-Number.pdf



HTH


You can also combine both steps together, just the regex is harder to read.
^(.*?)_(.*?)_(.*?)-(.*?)-(.*?)_(.*)$
\5-\4-\3 \1-\6

 


18/11-17 19:34 - edited 18/11-17 19:37