#1 2020-02-13 01:42

discodean
Member
Registered: 2018-02-17
Posts: 8

Rearrange/Move part of filename

Hi
I have a lots of movies with the year in many places, which I would like to move to the end of the filename.
I cannot see how to do this with rearrange.
Can you suggest how?

Example 1:
(1986) - Movie.avi
(1986) Movie.avi
to:
Movie (1986).avi

Example 2:
Movie 2016 1080p
to
Movie 1080p (1986).avi


Might have to be 2 step to remove the hyphen
TX

Offline

#2 2020-02-13 13:05

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 2,906

Re: Rearrange/Move part of filename

It would be very cumbersome to do it with the Rearrange rule.

It is better to use the Regular Expressions rule in this case:

1) Replace expression "\A\((\d{4})\)[\s\-]*(.*)\Z" with "$2 ($1)" (skip extension)
2) Replace expression "\A(.*)\s(\d{4})\s(.*)\Z" with "$1 $3 ($2)" (skip extension)

Input:

(1986) - Movie.avi
(1986) Movie.avi
Movie 2016 1080p.avi

Output:

Movie (1986).avi
Movie (1986).avi
Movie 1080p (2016).avi

Regular Expressions documentation:
https://www.den4b.com/wiki/ReNamer:Regular_Expressions

Offline

#3 2020-02-14 21:22

discodean
Member
Registered: 2018-02-17
Posts: 8

Re: Rearrange/Move part of filename

Tx, works a treat

Could you also suggest a regular expression to move the string 'The " to the end of the text and add an ",' before it, but not before the year, e.g.

The Clockwork Orange (197x)
to
Clockwork Orange, The (197x)

These regular experessions are beyond me, but I am starting to reverse engineer answers posted here to try to work them out and I have been able to write a couple of basic ones.

Tx
Dean

Offline

#4 2020-02-15 16:15

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 2,906

Re: Rearrange/Move part of filename

discodean wrote:

The Clockwork Orange (197x)
to
Clockwork Orange, The (197x)

Regular Expressions: Replace expression "\AThe\s+(.+?)\s+\(" with "$1, The (" (skip extension)

A quick breakdown:
\A - start of text.
The - literal "The".
\s+ - any number of white spaces.
(.+?) - any number of any characters, grouped to be referenced by $1.
\( - literal "(", escaped by "\".

Offline

#5 2020-02-18 00:03

discodean
Member
Registered: 2018-02-17
Posts: 8

Re: Rearrange/Move part of filename

Thanks for the reply and breakdown on the commands, that really helps me work things out

Offline

Board footer

Powered by FluxBB