#1 2016-10-03 09:17

Lauraq
Member
Registered: 2016-10-02
Posts: 78

remove all except one word

Re-Hi smile

Is possible remove all but one word in a file? For example, if the file is named:

Jovanotti - Il quinto mondo - front1.jpg

is possible delete all except "front" to have this result

front.jpg

thanks smile

Offline

#2 2016-10-03 11:03

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: remove all except one word

You can use a single Insert rule to replace the entire file name with "front":

Insert: Insert "front" replacing current name (skip extension)

Offline

#3 2016-10-03 21:01

Lauraq
Member
Registered: 2016-10-02
Posts: 78

Re: remove all except one word

but I wish it was Renamer to notice if, among other files, it is one with no name inside "front" and that the rename...

Offline

#4 2016-10-05 18:58

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: remove all except one word

Lauraq wrote:

but I wish it was Renamer to notice if, among other files, it is one with no name inside "front" and that the rename...

I don't fully understand you, but if you only need to change files which actually do contain "front" word, then you could use a RegEx rule:

Replace expression ".*\b(front)[\b\d].*" with "$1" (skip extension)

Input:

Jovanotti - Il quinto mondo - front1.jpg
Jovanotti - Il quinto mondo.jpg

Output:

front.jpg
Jovanotti - Il quinto mondo.jpg

If that is not what you want, then provide several complete examples which demonstrate what you want.

Offline

#5 2016-10-05 21:03

Lauraq
Member
Registered: 2016-10-02
Posts: 78

Re: remove all except one word

it is exactly what I want smile
Now I will try to figure out how to follow your help smile

I have proglem with the RegEx rule. In "Expression" I have write:

Replace expression ".*\b(front)[\b\d].*" with "$1" (jpg extension)

I have change (skip extension) becouse I want that it change only jpg extension files, is correct?

And in Replace what I must write? sad

Last edited by Lauraq (2016-10-06 19:42)

Offline

#6 2016-10-06 22:14

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: remove all except one word

You are not entering the rule configuration correctly.

Here is a demonstration of how it should be entered:

renamer-replace-all-with-front.png

Offline

#7 2016-10-06 23:36

Lauraq
Member
Registered: 2016-10-02
Posts: 78

Re: remove all except one word

perfect, thanks smile

ops probelm sad

...it work with

Jovanotti - Il quinto mondo - front1.jpg

but not for, an example, with

[Cd Cover] Frankie Hi-NRG Mc - Verba Manent - front.jpg

I m looking for a rule that work with all the pics that have the word "front" on it

Last edited by Lauraq (2016-10-07 00:11)

Offline

#8 2016-10-07 09:47

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: remove all except one word

Lauraq wrote:

...it work with

Jovanotti - Il quinto mondo - front1.jpg

but not for, an example, with

[Cd Cover] Frankie Hi-NRG Mc - Verba Manent - front.jpg

Change the expression to:

\A.*\b(front)(\b|[\d]+)\Z

Offline

#9 2016-10-07 12:00

Lauraq
Member
Registered: 2016-10-02
Posts: 78

Re: remove all except one word

thanks but now work with

[Cd Cover] Frankie Hi-NRG Mc - Verba Manent - front.jpg

and not with

digipack_front.jpg

sad

Offline

#10 2016-10-07 20:01

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: remove all except one word

Lauraq wrote:

now work with

[Cd Cover] Frankie Hi-NRG Mc - Verba Manent - front.jpg

and not with

digipack_front.jpg

That is because the rule excepts the "front" to be separated by a word boundary, while "_" character is considered to be part of a word.

A slightly adjusted expression should make it work:

\A.*(\b|_)(front)(\b|[\d]+)\Z

And change the replacement to:

$2

You can study how to use Regular Expressions here:
http://www.den4b.com/wiki/ReNamer:Regular_Expressions

Last edited by den4b (2016-10-07 20:03)

Offline

Board footer

Powered by FluxBB