Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

FIXNames

Apr
1,794
15
if a filename has either ( or ) it causes TCC/TCMD to double quote the name; Hence I think it would be nice if Fixnames would replace either char with maybe _ please.

Version I am using:
F/V: 0.28.0.0
P/V: 0.28.0
Size: 38.5
Date: 12/14/15 at 11:43am

P.S. Same thing with single quotes...... please....
 
Last edited:
I don't know why filename completion does that; I don't seem to need to quote such filenames. To prevent confusion with command grouping, perhaps? I've added a /C for parentheses.

Apostrophes: What's wrong with apostrophes?
 
Thank you Charles.

What is the web address for the plugin please?

Charles.
 
I am getting "No closing quote" on filenames so suggest quotes be added plz.....
 
I am getting "No closing quote" on filenames so suggest quotes be added plz.....
Theoretically, quotes are replaced with apostrophes. I don't know whether this has ever been tested, though. It shouldn't be possible to create a filename containing quotes -- they are illegal. Do you actually have filenames containing quotes?
 
I do have filenames with an uneven number of quotes, and ones with ">", as shown in the attached bad_names.txt, attached. I have not used fixnames yet.
 

Attachments

  • bad_names.txt
    710 bytes · Views: 343
about post #7, I made a filelist with CMD doing "dir /a:-d /b /o:gen /s -path- > listfile" then ran the attached testing.btm as testing listfile, just to help catch any filenames that are not ok with TCMD.....
 

Attachments

  • testing.btm
    318 bytes · Views: 341
I have JPGs with %20 whicgh I know is a space andwhile I could do a simple command wrapped around @replace[...] it would be great if FixNames DLL was modified to handle them as well please.
 
It should be doing that by default:

Code:
C:\>fixnames *.jpg
"C:\Test%20file.jpg" -> "C:\Test file.jpg"

Found 1, fixed 1, failed 0, skipped 0 in "C:\"


C:\>

Is it not working for you? (It's been a long time since I looked at that plugin.)
 
@Charles Dye What version of F/N are you using?

Module: c:\TCMD\Plugins\fixnames\FixNames-x64.dll
Name: FixNames
Author: Charles Dye
Email: [email protected]
Web: FixNames Plugin
Description: Renames filenames containing troublesome characters
Implements: fixnames
Version: 0.28 Build 1

I'll do more testing tomorrow afternoon....
 
Do the routines handle /S like the JPSoft commands do? e.g. how ATTRIB handles /S, /S2, /S+3 ? Also is there some docs as to what the bad chars are and what they are replaced with?
 
Do the routines handle /S like the JPSoft commands do? e.g. how ATTRIB handles /S, /S2, /S+3 ? Also is there some docs as to what the bad chars are and what they are replaced with?

No, /S is just /S. It doesn't take any fancy suboptions.

The list of things FIXNAMES may try to change is long, and affected by command line options, but here's a partial list:

%xx and =xx hexadecimal pairs decoded
caret and percent sign: changed to underscore
ampersand: changed to underscore
parentheses: changed to underscore (someone wanted this, I forget why)
C0 control characters 0x01 - 0x1f: changed to underscore
C1 control characters 0x80 = 0x9f: remapped to high-order Windows-1252 characters
double quote and backquote: remapped to apostrophe
non-breakable space and various fancy Unicode spaces: changed to ASCII space
Byte Order Mark: changed to underscore
spaces and periods at the end of the filename: stripped

Various thoroughly illegal characters like < > ? * / \ will be replaced with an underscore. However, since filenames containing these are illegal, the rename will probably fail. Sorry about that.
 
Trying to do a

Code:
for /r %fn in (*^,*.url) ren "%fn" "%@replace[^,,_,%fn]"

but that is not working. I'd hate to ask for commas to be changed to underscores but not sure why the code is not working.
 
! " # $ ' + , - . ; < = > ? @ [ ] _ ¯ ` { } ~ ‚ ƒ … † ˆ ‰ Š ” œ ¡ £ ¤ § ® ¯ Ø æ ø ú

That is the list of chars I am trying to replace.... they are from my URLs.....
 
Trying to do a

Code:
for /r %fn in (*^,*.url) ren "%fn" "%@replace[^,,_,%fn]"

but that is not working. I'd hate to ask for commas to be changed to underscores but not sure why the code is not working.

Try quoting that pattern:
Code:
for /r %fn in ( "*,*.url" ) ren /n "%fn" "%@replace[^,,_,%fn]"
 
@Charles Dye :
I have URLs named:
Amazon.co.uk_Music_Teenage_Mutant_Ninja_Turtles_2_Secret_of_Ooze_[SOUNDTRACK].url

I tried doing FIXNAMES /A /B /C /E /S and it didn't fix the [ or ]. then I tried escaping the [

FOR %fn in ("*^[*.url") echo %fn

Nothing was ECHOed. Any thoughts on this to help please?
 
@Charles Dye :
I have URLs named:
Amazon.co.uk_Music_Teenage_Mutant_Ninja_Turtles_2_Secret_of_Ooze_[SOUNDTRACK].url

I tried doing FIXNAMES /A /B /C /E /S and it didn't fix the [ or ]. then I tried escaping the [

FOR %fn in ("*^[*.url") echo %fn

Nothing was ECHOed. Any thoughts on this to help please?

Your command works for me, if I remove the caret. (Square brackets are legal filename characters.)

At one point I had a version of FixNames that allowed you to specify lists of arbitrary characters to replace. I'll have to dig that one out and dust it off for you. Might take me a few days.
 
I've uploaded an updated version of FixNames: FixNames Plugin

This one adds a couple of new options, /Q: and /R:. The first lets you specify a list of characters to replace (in addition to the plugin's built-in defaults). The second lets you specify replacement characters. So, to change square brackets to parentheses, you could:
Code:
fixnames /Q:[] /R:() *

I've also changed the .DLL names: FixNames.dll is now the 64-bit build; the 32-bit version is FixNames-x86.dll.
 
Code:
[C:\Users\Galloway\Favorites]fixnames /A /B /C /E /Q:" /R:_ /S *
FixNames plugin: Missing filespec

Would I need to use

Code:
/Q:^"

instead?
 
Double quotes are gone by that point; my arg parser removes them. (And escapes are removed before the plugin is even called; the command never sees them.)

But double quotes are in the built-in list of characters to replace anyway. They get changed to apostrophes. If you use /Q:' /R:_ to change apostrophes to underscores, you'll pick up double quotes at the same time. Kind of a kludge, I admit.
 
@Charles Dye :
To get to my place now I have:
Code:
DIR "%@shfolder[6]\*.url;*.lnk" /b /s > %tmp%\favs.txt
rem
rem edited favs.txt to remove path, then removed [a-z0-9_]
rem made sure only one chat per line in favs.txt
rem sorted then removed duplicate lines in favs.txt
rem -------
rem remaining chars are (char : ascii)
CHAR : ASCII
____________
    :    3
    :    7
   :   11
   :   12
    :   14
    :   21
   " :   34
   ' :   39
   - :   45
   . :   46
   ; :   59
   ? :   63
   @ :   64
   \ :   92
   _ :   95
   { :  123
   } :  125
   ~ :  126
    :  252
   ‚ :  233
   ƒ :  226
   … :  224
   † :  229
   ˆ :  234
   ‰ :  235
   Š :  232
    :  236
    :  197
    :  201
   ” :  246
   œ :  163
     :  225
   ¡ :  237
   ¤ :  241
   § :  186
   ® :  171
   ¯ :  187
   Ø : 9578
   æ :  181
   ø :  176
   ú :  183
____________

rem end of list.....

and that is the list after using every option then some of Q: and R:

I guess I can do ren "%fn" "%replace[whatever,new,%fn] for the others.... ?
 
I'm sorry, but I think I've lost the thread here. You actually have filenames containing control characters and double quotes? And FIXNAMES does not rename them?
 
How are you creating these files?

Using FireFox, and before that IE. they are favorites. I have attached favs.zip(favs.txt) that is a list of the files, with a-z0-9 replaced with a.
 

Attachments

  • favs.zip
    39.8 KB · Views: 218
@Charles Dye - it's not handling "&amp;" correctly. Be nice if it was to change the quoted to _ or similar. See the copy and pasted below:

===================
[C:\OEClassic\AOL GallowayC]dir

Volume in drive C is OS Serial number is 8293:971b
Directory of C:\OEClassic\AOL GallowayC\*

3/02/2021 22:17 <DIR> .
3/02/2021 22:17 <DIR> ..
3/02/2021 22:01 52,243 Brea%20&amp;%20Sandy%20&amp;%20Amy%20Lee%20in%20St%20John.jpg
3/02/2021 22:06 253,080 Free%20Bird2.jpg
305,323 bytes in 2 files and 2 dirs 307,200 bytes allocated
299,496,058,880 bytes free

[C:\OEClassic\AOL GallowayC]fixnames /A /B /C /E /S *
"C:\OEClassic\AOL GallowayC\Brea%20&amp;%20Sandy%20&amp;%20Amy%20Lee%20in%20St%20John.jpg" -? "C:\OEClassic\AOL GallowayC\Brea__amp;_Sandy__amp;_Amy_Lee_in_St_John.jpg"
"C:\OEClassic\AOL GallowayC\Free%20Bird2.jpg" -? "C:\OEClassic\AOL GallowayC\Free_Bird2.jpg"

Found 2, fixed 2, failed 0, skipped 0 in "C:\OEClassic\AOL GallowayC\"

GRAND TOTAL: Found 2, fixed 2, failed 0, skipped 0

[C:\OEClassic\AOL GallowayC]dir

Volume in drive C is OS Serial number is 8293:971b
Directory of C:\OEClassic\AOL GallowayC\*

3/02/2021 22:18 <DIR> .
3/02/2021 22:18 <DIR> ..
3/02/2021 22:01 52,243 Brea__amp;_Sandy__amp;_Amy_Lee_in_St_John.jpg
3/02/2021 22:06 253,080 Free_Bird2.jpg
305,323 bytes in 2 files and 2 dirs 307,200 bytes allocated
299,495,796,736 bytes free

[C:\OEClassic\AOL GallowayC]ren Brea__amp;_Sandy__amp;_Amy_Lee_in_St_John.jpg Brea__&_Sandy__&_Amy_Lee_in_St_John.jpg
C:\OEClassic\AOL GallowayC\Brea__amp;_Sandy__amp;_Amy_Lee_in_St_John.jpg -> C:\OEClassic\AOL GallowayC\Brea__
1 file renamed

OnError.btm: Not a valid command. You may edit it or
press ENTER to abort it.

OnError.btm: Not a valid command. You may edit it or
press ENTER to abort it.

[C:\OEClassic\AOL GallowayC]

===================
 
Back
Top