Page 1 of 3
Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 15:23
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.
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 15:33
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
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 15:42
by admin
Have you seen this syntax in Search an Replace:
Code: Select all
äöü>>aou = replace all ä with a, ö with o, ü with u
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 15:45
by SkyFrontier
Option to ignore htm/html/url extensions (user defined...) would also be useful. HTM(L) files tend to get screwed when renamed.
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 15:47
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.
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 15:54
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...?
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 16:11
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...
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 16:51
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!
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 17:13
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.
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 17:35
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).
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 17:51
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
.
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 18:22
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________, "*"
.
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 18:35
by SkyFrontier
Renaming by <empty> (deleting a given letter/word) would also make things easier:
.
All of this would cover a wide range of renaming once and for all, I believe.
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 19:56
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 |>"
Re: Easier Way to Rename Lots of Files with Unknown Characters
Posted: 03 Mar 2010 20:10
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.: