Rename fails to ID file of invalid char

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Rename fails to ID file of invalid char

Postby chrisjj » Thu Jul 17, 2025 4:49 pm

On Windows7 64-bit BRU 4.0.0.9, renaming my X,000 files says:

Image

failing to ID the file(s). A fix would be great!

Meanwhile any way to find out which file(s)?
chrisjj
 
Posts: 79
Joined: Wed Mar 30, 2011 5:26 pm

Re: Rename fails to ID file of invalid char

Postby chrisjj » Thu Jul 17, 2025 4:54 pm

You'd hope Status would help, but no - it is blank.
chrisjj
 
Posts: 79
Joined: Wed Mar 30, 2011 5:26 pm

Re: Rename fails to ID file of invalid char

Postby Admin » Fri Jul 18, 2025 7:10 am

You can find them in the Preview dialog searching for the illegal characters; however, it is a bit tedious ...
Admin
Site Admin
 
Posts: 3006
Joined: Tue Mar 08, 2005 8:39 pm

Find or filter now-names with invalid characters

Postby Luuk » Fri Jul 18, 2025 9:01 am

If its the now-names, the checkmark for "Regex" in Filters(12) could find them with a "Mask" like...
[:*?"\/<>|]
Or to remove those now-names from the file-list, can change the "Mask" to...
^(?!.*[:*?"\/<>|])


If its the new-names, I would just put :*?"\/<>| inside of the "Chars" for Remove(5).
But to troubleshoot, can use "Copy to Clipboard, Pathname + New Pathname", then let a text-editor search the characters.
This could also help show any illegal characters that might also be inside of their fullpathnames.
Luuk
 
Posts: 825
Joined: Fri Feb 21, 2020 10:58 pm

Re: Rename fails to ID file of invalid char

Postby chrisjj » Fri Jul 18, 2025 11:34 am

Admin wrote:You can find them in the Preview dialog searching for the illegal characters;


Thanks. Could you pass on my request that the program do this? Or better, that the main file list show them.

Admin wrote:however, it is a bit tedious ...


Agreed. Because the error does not ID the characters either. And Preview Find omits to show the character location. And you have to then manually locate the file in the main file list to make the amendment.

However it is better than nothing, for which I thank you.
chrisjj
 
Posts: 79
Joined: Wed Mar 30, 2011 5:26 pm

Re: Find or filter now-names with invalid characters

Postby chrisjj » Fri Jul 18, 2025 11:38 am

Luuk wrote:If its the new-names


It is.

Luuk wrote:I would just put :*?"\/<>| inside of the "Chars" for Remove(5).


That doesn't catch the invalid chars originating from JavaScript Renaming here.

How I wish there was an option to do the JSR first...

Luuk wrote:But to troubleshoot, can use "Copy to Clipboard, Pathname + New Pathname", then let a text-editor search the characters.


Thanks.
chrisjj
 
Posts: 79
Joined: Wed Mar 30, 2011 5:26 pm

Re: Rename fails to ID file of invalid char

Postby Luuk » Fri Jul 18, 2025 1:37 pm

Since the invalid characters are created by JavaScript...
Can use Special(14) "Order" to make JavaScript conduct first.
Luuk
 
Posts: 825
Joined: Fri Feb 21, 2020 10:58 pm

Re: Rename fails to ID file of invalid char

Postby chrisjj » Fri Jul 18, 2025 1:43 pm

Luuk wrote:Can use Special(14) "Order" to make JavaScript conduct first.


Thanks, but that's unavailable here, 4.0.0.9.

Image
chrisjj
 
Posts: 79
Joined: Wed Mar 30, 2011 5:26 pm

Re: Rename fails to ID file of invalid char

Postby Luuk » Fri Jul 18, 2025 5:05 pm

It's unfortunate, but I cannot have access to the BRU right now.
If making Remove(5) conduct last wont remove them, I would edit the javascript to something like...

newName1 = Your-Javascript-Code
newName = newName1.replace(/[:*?"\\\/<>|]/g, "")

I cannot test the regex until getting to a computer, but Im sure admin could also help with other ways to remove characters in javascript. It will be many hours before I'm at the computer again to test the regex in javascript.
Luuk
 
Posts: 825
Joined: Fri Feb 21, 2020 10:58 pm

Remove illegal-characters from new-names

Postby Luuk » Sat Jul 19, 2025 4:20 am

My version (4.0.0.8) also cannot edit the order for when javascript should conduct?
I did believe its at the bottom when scrolling down, but mine stops at Extensions(11).
And moving Remove(5) to the very bottom, wont let him conduct after the javascript.

But since javascript invents the illegal-characters, he can also remove them.
This the way I tested it when getting to a computer, now modified...

// Prefix all names with illegals, then make sure .replace() removes them all...
newName1 = ":*?\"\\/<>|" + name
newName = newName1.replace(/[:*?"\\/<>|]/g, "")
Luuk
 
Posts: 825
Joined: Fri Feb 21, 2020 10:58 pm

Re: Rename fails to ID file of invalid char

Postby Admin » Sat Jul 19, 2025 9:24 am

// Function to remove characters not allowed in Windows NTFS filenames
var sanitizeName = function(s) {
// Remove control chars (0x00–0x1F) and forbidden characters: < > : " / \ | ? *
s = s.replace(/[\x00-\x1f<>:"\/\\|?*]/g, "");
// Remove any trailing spaces or dots (Windows NTFS disallows names that end with space or period)
s = s.replace(/[ .]+$/g, "");
return s;
};

// Example transformations:
// name = "my<bad>file?:.txt" => sanitizeName(name) yields "mybadfile"
// name = "trailing space . " => sanitizeName(name) yields "trailing space"

// Apply sanitization
newName = sanitizeName(name);
Admin
Site Admin
 
Posts: 3006
Joined: Tue Mar 08, 2005 8:39 pm


Return to BRU Support