Page 1 of 1

Find And Replace Illegal Characters

PostPosted: Tue Jun 29, 2021 2:16 pm
by IAPJF
I am wondering how Bulk Rename Utility can do two things:

1. Search an entire directory and sub-directory such as G:\*.* to find illegal characters (Latin characters that have access and are not recognized by Windows)
2. Replace in bulk the Latin characters

Thanks.

Jeffrey

Re: Find And Replace Illegal Characters

PostPosted: Tue Jun 29, 2021 4:34 pm
by therube
For finding files, there is nothing better then Everything.

Now depending on what you're considering "illegal"... looking for a way to return a list of files with extended ascii characters.
(The search range can certainly be adjusted.)


After that... you can drag them into BRU.
After that... I'm not so sure.

This is not correct, but can give you an idea:
1:RegEx, v2 (enable)
Code: Select all
Match:  ([^\x00-\x7f])(.*)
Replace: <leave blank>

What that will do is to truncate everything after the "illegal" character (which is not what you're going to want).

Code: Select all
10áhi-NOT.txt
   -> 10.txt
10 hi, now this IS non-blanking space.txt
   -> 10.txt
01·01·95
   -> 01
--++¦+--++-¦+˜.htm
   -> --++.htm

Re: Find And Replace Illegal Characters

PostPosted: Wed Jun 30, 2021 8:15 am
by Luuk
Yes, nobody can know for certain what does mean 'illegal' or 'access', but the Filters(12) "Mask" can also find your 'illegal' files.
If therube guesses correctly for illegal, then Filters(12) would need a checkmark in "RegEx" and a "Mask" like [^\x00-\x7f]
Then you just click the blue-arrows to the right of Mask to present your 'illegal' files.

If you need to remove all of the illegal characters, then its best to use RegEx(1) with a range, like therube is describing.
If you need to replace them, Regex(1) also does this, but its easier using Replace(3) or "Special, Character Translations".

With "Special, Character Translations", many replacements are conducted like...
IllegalCharacter1=ReplaceCharacter1
IllegalCharacter2=ReplaceCharacter2
IllegalCharacter3=ReplaceCharacter3

With Replace(3), many replacements are conducted with a "Replace" and "With" like...
'illegal--1'|'illegal--2'|'illegal--3'|...
replace-1|replace-2|replace-3|...

With "v2" Regex(1), many replacements are conducted with a "Match" and "Replace" like...
illegal-1/g(?X)illegal-2/g(?X)illegal-3/g(?X)...
replace--1(?X)replace--2(?X)replace--3(?X)...