#1 2021-07-27 03:01

JuaBra
Member
Registered: 2021-07-27
Posts: 3

Remove accents only on some parts of the file name

Hi,

How can I remove accents only in the author's book name (keeping the accents in the name of the books). Ex:

João Cândido Júnior – A explosão do último apêndice.pdf

Would be:

Joao Candido Junior – A explosão do último apêndice.pdf

Sentences are always separated by ( - )

Any help will be greatly appreciated!

Offline

#2 2021-07-27 14:33

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Remove accents only on some parts of the file name

Hi and welcome.

I will show you my way.



To change the accents I would create a Transliteration List
https://www.den4b.com/wiki/ReNamer:Rules:Translit


- For example for  Portuguese I use a list from here
https://en.wikipedia.org/wiki/Portuguese_orthography


- use an text editor like Notepad2 and a empty file
- switch to "File > Encoding > UTF-8"

- copy and paste the list of chars from the above wiki link into the editor
á    a
â    ? (?~)
ã    ?~
....
......


- use Notepad2 block selection to keep only the first row of chars
á
â
ã
....
......


- use "Modify Lines" (Alt+M) to add trailing = -sign
á=
â=
ã=
....
......



- now add after the equal sign the char you want to get
á=a
â=a
ã=a
....
......


- save that file as "\ReNamer\Translits\Portuguese.txt"

Now you can use it like showed there
https://www.den4b.com/wiki/ReNamer:Rules:Translit


- - -


To work on an part of the file name only, we will do an trick and change temporally the extension part:

>>> we have "João Cândido Júnior – A explosão do último apêndice.pdf"
1) Replace: Replace last "." with "#" ((( or any other sign not already part of your file names ))) --- (do NOT skip extension)
2) Replace: Replace first " – " with "." ((( attention you have an unicode hyphen sign here, copy and paste it ))) --- (do NOT skip extension)
>>> we get "João Cândido Júnior.A explosão do último apêndice#pdf"
3) Translit: Transliterate á->a, â->a, ã->a, à->a, ç->c, é->e, ê->e, è->e, í->i, ì->i, ó->o, ô->o, õ->o, ò->o, ú->u, ù->u (16 parts) (auto case adjustment) (skip extension)
4) Replace: Replace first "." with " – " --- (do NOT skip extension)
5) Replace: Replace last "#" with "." --- (do NOT skip extension)

[Preview]
>>> we get "Joao Candido Junior – A explosão do último apêndice.pdf"
[Rename]

Done


Take care on the "(skip extension)"-parts.


 


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#3 2021-07-27 19:25

JuaBra
Member
Registered: 2021-07-27
Posts: 3

Re: Remove accents only on some parts of the file name

Worked perfectly!

As a matter of fact, the Translits "portuguese.txt" built into ReNamer's software is ready to use. I just loaded it up and made the replaces.

The trick you used to temporarity change the extension part of the file is a master piece. Genius work! Congratulations!

Thank you very much, from my heart.

Your brazilian friend, JuaBra.

Offline

#4 2021-07-28 06:08

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

Re: Remove accents only on some parts of the file name

An alternative way here that uses the recently added option "Strip unicode marks" from the Clean Up rule.

The idea is to strip all unicode marks first (diacritics, accents, etc) from the entire filename, and then restore the 2nd part of the filename from the original filename using meta tags.

1) Delete: Delete from Delimiter " – " until the End (skip extension)
2) Clean Up: Strip unicode marks (skip extension)
3) Insert: Insert " – :File_BaseName:" as Suffix (skip extension)
4) Rearrange: Split by exact pattern of delimiters " – ", " – ", New pattern "$1 – $3" (skip extension)

Before:

João Cândido Júnior – A explosão do último apêndice.pdf

After:

Joao Candido Junior – A explosão do último apêndice.pdf

Offline

#5 2021-07-29 20:28

JuaBra
Member
Registered: 2021-07-27
Posts: 3

Re: Remove accents only on some parts of the file name

This method, besides being simpler, is more reliable, since there are some titles that end up with reticence (...) and the previous method did not consider it.
Thank you very much! Worked like a charm. You all are fantastic!

Offline

Board footer

Powered by FluxBB