Regexes in REN/MOVE/… commands seem to not work at all

May 20, 2017
22
0
We had a similar question back in August 2016; the poster concluded that a drive letter makes him happy. That doesn't work for me:

C:\tmp\tt> for %f in (1 2 3 4 5 6) do echo foo > a%f

C:\tmp\tt> dir

Volume in drive C is OS Serial number is 566b:ed1e
Directory of C:\tmp\tt\*

2017-07-08 00:24 <DIR> .
2017-07-08 00:24 <DIR> ..
2017-07-08 00:24 5 a1
2017-07-08 00:24 5 a2
2017-07-08 00:24 5 a3
2017-07-08 00:24 5 a4
2017-07-08 00:24 5 a5
2017-07-08 00:24 5 a6
30 bytes in 6 files and 2 dirs 24'576 bytes allocated
245'771'546'624 bytes free

C:\tmp\tt> ren ::a(.*) ::\1 /n
TCC: (Sys) There are no more files.
"C:\tmp\tt\::a(.*)"
0 files would be renamed

C:\tmp\tt> ren "::a(.*)" "::\1" /n
TCC: (Sys) There are no more files.
"C:\tmp\tt\::a(.*)"
0 files would be renamed

C:\tmp\tt> ren "c:\tmp\tt\::a(.*)" "::\1" /n
TCC: (Sys) There are no more files.
"C:\tmp\tt\::a(.*)"
0 files would be renamed

I seem to recall that this worked in a previous major release, 18 or 19 or so. Now I use:

TCC 21.00.31 x64 Windows 10 [Version 10.0.15063]
TCC Build 31 Windows 10 Build 15063

Thanks,
Felix.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
Your exact syntax works here (v21); it also works without the quotes.
Code:
v:\20000files> touch /c a1 a2 a3 a4
2017-07-07 20:13:20.643  V:\20000files\a1
2017-07-07 20:13:20.643  V:\20000files\a2
2017-07-07 20:13:20.643  V:\20000files\a3
2017-07-07 20:13:20.643  V:\20000files\a4

v:\20000files> ren "::a(.*)" "::\1" /n
V:\20000files\a1 -> V:\20000files\1
V:\20000files\a2 -> V:\20000files\2
V:\20000files\a3 -> V:\20000files\3
V:\20000files\a4 -> V:\20000files\4
     4 files would be renamed
 
May 20, 2017
22
0
Your exact syntax works here (v21); it also works without the quotes.

Thanks for trying this, I appreciate it!

Maybe I am going slowly nuts. Or maybe it fails on Windows 10 in general, as opposed to Win7. Or maybe it fails on Windows 10 update 1703 — as I recall, I upgraded Windows and TCC at pretty much the same time.

If any of the esteemed readers happen to have Win10 lying around, I'd love to hear whether regex renames work on that!
 
Similar threads
Thread starter Title Forum Replies Date
F WAD SWITCH statement with regexes or wildcards as CASE expressions Support 9
D Regexes and escape characters Support 5
Jesse Heines Using Regular Expressions with the REN commanc Support 8
C Documentation Help Nit. REN / RENAME Support 0
D How to? Use regular expression with REN? Support 2
vefatica REN and NTFS streams? Support 3
samintz REN implied .* Support 2
D How to? Wildcards as sets - looping issue with FOR and REN Support 7
samintz WAD Weird REN bug Support 6
S REN and FOR %a with files Support 8
nickles REN bug Support 11
Phileosophos ren /s does not process subdirectories Support 3
M Ren command confusion Support 13
S Strange REN problem - non-English characters Support 3
T REN a TCC Tab from command line Support 9
C question re: Move Support 3
samintz MOVE and Prompt on overwrite Support 3
M MOVE does not behaves like intended (on failure) Support 1
kb6ojs Make /G parameter persistent in COPY/MOVE command? Support 4
T How to? Off screen move? Support 3
fpefpe Documentation copy/move using /c or /u Support 2
W Recursive move aborts early Support 2
C b21 MOVE /B Support 8
D How move cursor out of popup edit control after no match? Support 14
nickles Move takecommand.18.0.key location to installation directory Support 4
J junction copy/move handling Support 6
J WAD move /s regression from tcc15 Support 5
C move /F Support 4
vefatica MOVE anomaly Support 8
C Move /s sorce target Support 13
Stefano Piccardi b32 move /Q writes message Support 1
C How to? MOVE and handling out of space Support 2
Joe Caverly How to? Move Window Between Monitors Support 6
S How to? Move files older than one year Support 9
fpefpe move /g Support 4
C Move /MD not always working Support 1
C Move question with Encrypted file... Support 6
W /g option (%) on MOVE cmd appears broken TCC 14.03.57 x64 Support 8
G Fixed MOVE truncates files Support 9
C MOVE making empty destinatation sub-folders Support 10
thedave Move files, inherit permissions Support 14
A Discrepancy in handling of "can't copy or move file to itself" Support 4
A expected behavior of move /sx Support 14
S MOVE from FTP directory to another FTP directory - bug?? Support 2
J directory tree - move or copy Support 3
D MOVE Help typo Support 3
D Suggest Help mention /n no effect in move /n Dir1 Dir2 Support 0
D Move /v to DVD fails but files identical Support 4
S Conditionally MOVE/COPY files on the basis of size Support 1
S MOVE to different drive Support 3

Similar threads