Filenames with ";"

#1
I want to replace filenames that contain ";" with "_". I can't even get plain DIR to find the files.

Code:
for %fn in ("*;*") ren "%fn" "%@replace[;,_,%fn]"

dir /a:-d /b /s "*;*"
Both do not work.

@vince - would this be a good char to have your fixnames plugin to work on?
 
#3
I want to replace filenames that contain ";" with "_". I can't even get plain DIR to find the files.

Code:
for %fn in ("*;*") ren "%fn" "%@replace[;,_,%fn]"

dir /a:-d /b /s "*;*"
Both do not work.
Interesting. Both of the above work for me (under TCC 20.00.14 x64 — Windows 10 Pro). The renaming worked fine:

D:\temp> for %fn in ("*;*") ren "%fn" "%@replace[;,_,%fn]"
D:\temp\test2;hello.txt -> D:\temp\test2_hello.txt
1 file renamed
D:\temp\test3;goodbye.txt -> D:\temp\test3_goodbye.txt
1 file renamed
 
#4
It doesn't seem much different from the comma (except that I couldn't make one with TOUCH).
Code:
v:\> echo foo > "a;b.txt"

v:\> d "*;*"
2017-05-17  12:11               5  a;b.txt

v:\> do f in "*;*" (ren "%f" %@replace[;,_,%f])
V:\a;b.txt -> V:\a_b.txt
     1 file renamed
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,602
46
Albuquerque, NM
prospero.unm.edu
#5
Suggestion for a future version: Allow the vertical bar | as an include-list separator, behaving just the same as the semicolon. Then in some more-distant-future version, the semicolon could be deprecated.... Filespecs containing a vbar would need to be quoted, of course, just like spaces, ampersands, et cetera.

(The choice of semicolon for this function goes back to 4DOS. IIRC, semicolon was not a legal filename character in DOS, so it made sense at the time.)
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,602
46
Albuquerque, NM
prospero.unm.edu
#7
And what would we do with pipes? And a jillion batch files and aliases using pipes?
You already have that part implemented. A vertical bar between quotes has no special meaning.

Code:
C:\>dir "*.bat|*.cmd|*.btm"

 Volume in drive C is Hard Drive     Serial number is 6218:b594
TCC: (Sys) The system cannot find the file specified.
 "C:\*.bat|*.cmd|*.btm"
                   0 bytes in 0 files and 0 dirs
     156,308,537,344 bytes free

C:\>
 
#9
Not sure what you're getting at -- a semicolon between quotes has no special meaning either.
Is that so? Why did my first attempt to create "a;b" fail?
Code:
v:\> touch /c "a;b"
2017-05-17 20:28:38.034  V:\b
And there seems to be a special meaning here also.
Code:
v:\> *dir /a /p /m /k /h /ne "a;b"
2017-05-17  20:28               0  b