Easier Way to Rename Lots of Files with Unknown Characters

Features wanted...
SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Easier Way to Rename Lots of Files with Unknown Characters

Post by SkyFrontier »

Similar to "character to replace invalid characters in dropped messages", right click a bunch of files, "rename special>search and replace", "option to rename all invalid (given/previously set on F9>Templates) characters in this batch".
Or a script that could write entries into an .ini file so in a renaming session it would be just a matter of editing what will be replaced with which.
Any ideas, please...?

Code: Select all

Σ/_;ç/c;á/a;?/_;ã/_;<all unknown/non specified>/_;(/_;)/_;
and so on - all in a single operation.

Reason: a given folder contains samples of documents not supported under Non-ANSI and/or Non-UTF compliant programs, so I'd like to eliminate all the annoyances in a heartbeat, having previously saved their original names in an .rtf file for the record.

Thanks.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by SkyFrontier »

Desired enhancement would be the ability to detect whether the file is lower/upper case and keep that way, despite only having lower OR upper case as search patterns.

Code: Select all

search pattern: é/e

Renaming files:
México > Mexico
SOCIÉTÉ > SOCIETE
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

admin
Site Admin
Posts: 66366
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by admin »

Have you seen this syntax in Search an Replace:

Code: Select all

äöü>>aou  =  replace all ä with a, ö with o, ü with u

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by SkyFrontier »

Option to ignore htm/html/url extensions (user defined...) would also be useful. HTM(L) files tend to get screwed when renamed.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by SkyFrontier »

Admin:
Have you seen this syntax in Search an Replace:
Code:
äöü>>aou = replace all ä with a, ö with o, ü with u
Not on right click menu. Looking for it anywhere now (in a hurry, sorry).
Thnx.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by SkyFrontier »

Have you seen this syntax in Search an Replace:
Code:
äöü>>aou = replace all ä with a, ö with o, ü with u
...prior to your post, just found "Unicode to UTF-8", which I fear to test on a whole bunch of files I'm getting ready to backup on optical drives. Would that work fawlessly, I mean - keeping chars in ways you pointed above?
(still haven't found a way other than File/Rename Special/Remove Particular Characters..., which by its wording will KEEP and not REPLACE files in a user specified pattern).

-when a name collision is found, could we have option to enter a name besides the current keep/cancel format...?
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

admin
Site Admin
Posts: 66366
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by admin »

SkyFrontier wrote:
Have you seen this syntax in Search an Replace:
Code:
äöü>>aou = replace all ä with a, ö with o, ü with u
...prior to your post, just found "Unicode to UTF-8", which I fear to test on a whole bunch of files I'm getting ready to backup on optical drives. Would that work fawlessly, I mean - keeping chars in ways you pointed above?
(still haven't found a way other than File/Rename Special/Remove Particular Characters..., which by its wording will KEEP and not REPLACE files in a user specified pattern).

-when a name collision is found, could we have option to enter a name besides the current keep/cancel format...?
No.

You enter a pattern like äöü>>aou into Search and Replace.

Fear: You can preview the results by checking "Preview All" on the bottom of the rename special sub menu. And there's undo...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by SkyFrontier »

Will try all later, considering

Code: Select all

Desired enhancement would be the ability to detect whether the file is lower/upper case and keep that way, despite only having lower OR upper case as search patterns.

Code:
search pattern: é/e

Renaming files:
México > Mexico
SOCIÉTÉ > SOCIETE
Any word on...
-when a name collision is found, could we have option to enter a name besides the current keep/cancel format...?
?
That would be the equivalent thing to new ability "create new folders on the fly" regarding renaming, in my opinion.
Thank you, Don!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by Stefan »

SkyFrontier wrote:Desired enhancement would be the ability to detect whether the file is lower/upper case and keep that way, despite only having lower OR upper case as search patterns.

Code: Select all

search pattern: é/e

Renaming files:
México > Mexico
SOCIÉTÉ > SOCIETE
Maybe you can collect an list of such diacritical signs
and create an script like that:

Code: Select all

$curname = "México - SOCIÉTÉ";
 //$curname = replace( $curname, "find", "replace", case sensitive);
   $curname = replace( $curname, "é", "e", 1);
   $curname = replace( $curname, "É", "E", 1);
   msg $curname;
http://en.wikipedia.org/wiki/Diacritic

Or find an command line tool to call from an script for each file name.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by SkyFrontier »

Using the pattern:


Code: Select all

ñáàâéèêíìîóòôúùûç[]{}()&>>naaaeeeiiiooouuuc______and
OR

Code: Select all

ñáàâéèêíìîóòôúùûç[]{}()&>>naaaeeeiiiooouuuc&&&&&&and
gives a message that "(lists) must have the same lenght."

USING THIS PATTERN:

Code: Select all

ñáàâãéèêíìîóòôõúùûç.,[]{}()>>naaaaeeeiiioooouuuc________

went fine.

Problem was with the "&" character, which I wanted to replace with "and".
Workaround: do a second search & replace just for that.

Portuguese users, go ahead with that small piece of code!

Regarding your comment, Stefan (thanks!), I intended to search and replace only the letters "é" for "e" and "É" for "E" (case sensitive, yes!), but not one word for another ("México - SOCIÉTÉ").

But your point gave me a hint, so later I'll try to study scripting based on your writing and find a solution.

-but I really think that an "auto-replacing" function would be great (possibly "Unicode to UTF-8", haven't tried it yet!). And I try to preserve XY as small and 3rd-party free as possible - portability reasons.
Thanks again!

edit: Edited pattern to include "ã/õ". Changed font for the records (easier to distinguish as an ANSWER).
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by SkyFrontier »

Hmmmm...
what about being able to do something like

Code: Select all

ñáàâãéèêíìîóòôõúùûç.,[]{}()"&">>naaaaeeeiiioooouuuc________"and"
?
Unicode to UTF is NOT an answer:

Code: Select all

Folha de SP - Cozinha país a país - Itália.pdf
Folha de SP - Cozinha país a país - França.pdf
Folha de SP - Cozinha país a país - Tailândia.pdf
turned into

Code: Select all

Folha de SP - Cozinha país a país - Itália.pdf
Folha de SP - Cozinha país a país - França.pdf
Folha de SP - Cozinha país a país - Tailândia.pdf
.
UTF to Unicode:

Code: Select all

Folha de SP - Cozinha pas a pas - Itlia.pdf
Folha de SP - Cozinha pas a pas - Frana.pdf
Folha de SP - Cozinha pas a pas - Tailndia.pdf
Should be

Code: Select all

Folha de SP - Cozinha pais a pais - Italia.pdf
Folha de SP - Cozinha pais a pais - Franca.pdf
Folha de SP - Cozinha pais a pais - Tailandia.pdf
.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by SkyFrontier »

...am I missing (another) something or I really can't put the
äöü>>aou
search/replace pattern in a script?

http://88.191.26.34/XYwiki/index.php/Sc ... nd:_rename
tells me that I can

Code: Select all

Defines the mode for the rename operation :
    * b : [Default] Batch Rename
    * r : RegExp Rename
    * s : Search and Replace
    * k : Keep Particular Characters
    * e : Set Extension 
...but can't find a way to, example:

Code: Select all

rename s, ñáàâãéèêíìîóòôõúùûç.,[]{}()>>naaaaeeeiiioooouuuc________, <curitem>
or

Code: Select all

::rename s, ñáàâãéèêíìîóòôõúùûç.,[]{}()>>naaaaeeeiiioooouuuc________, "*"
.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by SkyFrontier »

Renaming by <empty> (deleting a given letter/word) would also make things easier:

Code: Select all

ñáàâã"and">>naaaa""
.

All of this would cover a wide range of renaming once and for all, I believe.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Muroph
Posts: 561
Joined: 21 Aug 2007 16:13

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by Muroph »

SkyFrontier wrote:...am I missing (another) something or I really can't put the
äöü>>aou
search/replace pattern in a script?
(...)

Code: Select all

rename s, ñáàâãéèêíìîóòôõúùûç.,[]{}()>>naaaaeeeiiioooouuuc________, <curitem>
you need to quote the parameters.
this will rename all selected items:

Code: Select all

rename s, "ñáàâãéèêíìîóòôõúùûç.,[]{}()>>naaaaeeeiiioooouuuc________", "<get SelectedItemsPathNames |>"
My shared scripts:
TeraCopy Integration, Tag Manager, Comments Menu, Text Replacer, Image and Media Tools, Checksum Calculator, Video Calculator
only 5 URLs are allowed on the sig...

admin
Site Admin
Posts: 66366
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Easier Way to Rename Lots of Files with Unknown Characters

Post by admin »

If there's a demand I can add the possibility to replace many chars of different lengths. But the patterns will look a bit clumsy since we need to have a separator. We could use ">>>" to mark this from of syntax, e.g.:

Code: Select all

ä|ö|ü>>>ae|oe|ue

Post Reply