Simple RegEx copy

Hi,
I'm in a directory.

I'm trying this:
copy ::test(.*) ::\\workflows\\filetrain\\00306-claro-smms-iasb\\test2016\1

I get this:
F:\workflows\test-filetrain\00306-Claro-SMMS-IASB\test-txtri2-au-nl-3.png => F:\workflows\test-filetrain\00306-Claro-SMMS-IASB\\workflows\filetrain\00306-claro-smms-iasb\test2016-txtri2-au-nl-3.png
TCC: (Sys) The system cannot find the path specified.

Why doesn't it even have a spaceband between the source and the target here?

All I want to do is to copy files, add some characters at the front of the filename, keeping the rest of the filename.

Thanks!
Peter
 
May 20, 2008
11,300
95
Syracuse, NY, USA
Something similar works here. Rex, if your reading, it seems a little odd that COPY puts "\\" in the destination path.
Code:
v:\> copy ::bigc(.*) ::\\test1\\foo-bigc\1
V:\bigc.175pipe => V:\\test1\foo-bigc.175pipe
V:\bigc.output => V:\\test1\foo-bigc.output
V:\bigc.sort175 => V:\\test1\foo-bigc.sort175
V:\bigc.sortexe => V:\\test1\foo-bigc.sortexe
V:\bigc.tmp2 => V:\\test1\foo-bigc.tmp2
V:\bigc.txt => V:\\test1\foo-bigc.txt
  6 files copied
 
My commands look the same, but, they're not working. I'm using the double backslashes, because the target is a regex, too. It's telling me "The system cannot find the path specified."

copy ::test-(.*) ::\\workflows\\filetrain\\00306-claro-smms-iasb\\test2016\1

These are the two files in this directory:
test-txtri2-au-nl-3.png
test-txtri2-au-nl-4.png

I get this:
F:\workflows\test-filetrain\00306-Claro-SMMS-IASB\test-txtri2-au-nl-3.png => F:\workflows\test-filetrain\00306-Claro-SMMS-IASB\\workflows\filetrain\00306-claro-smms-iasb\test2016txtri2-au-nl-3.png
TCC: (Sys) The system cannot find the path specified.
F:\workflows\test-filetrain\00306-Claro-SMMS-IASB\test-txtri2-au-nl-4.png => F:\workflows\test-filetrain\00306-Claro-SMMS-IASB\\workflows\filetrain\00306-claro-smms-iasb\test2016txtri2-au-nl-4.png
TCC: (Sys) The system cannot find the path specified.
0 files copied 2 failed
 
May 20, 2008
11,300
95
Syracuse, NY, USA
I get quite different results if I include a drive letter in the destination. This looks like a bug. But I didn't see regular expressions mentioned in the help for COPY. Maybe we're expecting too much.
Code:
v:\> copy ::bigc(.*) ::v:\\test1\\foo-bigc\1
V:\bigc.175pipe => v:\test1\foo-bigc.175pipe
V:\bigc.output => v:\test1\foo-bigc.output
V:\bigc.sort175 => v:\test1\foo-bigc.sort175
V:\bigc.sortexe => v:\test1\foo-bigc.sortexe
V:\bigc.tmp2 => v:\test1\foo-bigc.tmp2
V:\bigc.txt => v:\test1\foo-bigc.txt
V:\test1foo-bigc.175pipe => test1foo-v:\test1\foo-bigc.175pipe
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
V:\test1foo-bigc.output => test1foo-v:\test1\foo-bigc.output
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
V:\test1foo-bigc.sort175 => test1foo-v:\test1\foo-bigc.sort175
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
V:\test1foo-bigc.sortexe => test1foo-v:\test1\foo-bigc.sortexe
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
V:\test1foo-bigc.tmp2 => test1foo-v:\test1\foo-bigc.tmp2
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
V:\test1foo-bigc.txt => test1foo-v:\test1\foo-bigc.txt
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
  6 files copied  6 failed
 
May 20, 2008
11,300
95
Syracuse, NY, USA
The leading "\\" is telling TCC that you're referencing a UNC, not a drive path. (The UNC checking is occurring *before* the back reference check.)
... even though it's in an RE (prefixed by "::")? If COPY with RES in both source and destination, and back-ref substitution in the deswtination is realll supposed to work, that's nice, and it might be mentioned in the help (if it's there, I missed it).
 

rconn

Administrator
Staff member
May 14, 2008
12,318
148
I'm trying this:
copy ::test(.*) ::\\workflows\\filetrain\\00306-claro-smms-iasb\\test2016\1

I get this:
F:\workflows\test-filetrain\00306-Claro-SMMS-IASB\test-txtri2-au-nl-3.png => F:\workflows\test-filetrain\00306-Claro-SMMS-IASB\\workflows\filetrain\00306-claro-smms-iasb\test2016-txtri2-au-nl-3.png
TCC: (Sys) The system cannot find the path specified.

The correct syntax would be something like:

copy ::test(.*) \workflows\filetrain\00306-claro-smms-iasb\::test2016\1

You only want the regex to be the filename, not the entire path.
 
Similar threads
Thread starter Title Forum Replies Date
samintz How to? TPIPE /simple=61 Support 6
GermanDirk How to? EVENTLOG Command with simple User Rights not functional Support 4
H TPIPE /simple=4 Support 12
T How can I send a simple parameter to a script, in tc 25? Support 2
C No simple way to tell new Alerts Support 8
C WAD tpipe /simple=28 Support 8
C tpipe /simple=28 error Support 5
P WAD TC 15.0.1.58 x64 crasches with a simple dir command Support 18
M Maybe Maybe I'm being stupid (again), but a simple question... Support 4
M What am I doing wrong in this (very simple!) code? Support 3
M How to? A very simple question re. the current line number in a batch file... Support 2
C Simple .bat question - dump contents of 2 dimensional array Support 2
M Another simple question re. Take Command/TCC window witdth in characters... Support 16
M Simple question about "Function" command... Support 4
M A simple question related to the "dir" (and "pdir") commands... Support 5
P "Simple question" concerning insert/overstrike mode Support 17
D Some feedback on simple batch file Support 2
F %@regex["^-","-a"] returns 0, "^-" =~ "-a" is false (no match) Support 4
JohnQSmith Regex renaming Support 2
vefatica TPIPE: unbalanced escaped quotes in a regex? Support 5
rps Regex problem: \xnn not recognized as a hex character Support 0
old coot Regex problem: \xnn not recognized as a hex character Support 12
R Regex using ^ Support 2
T Regex engine doesn't recognize native DOS line endings Support 2
samintz WAD Regex Analyzer Support 1
D How to? Use typed envars using regex. Support 3
P Renaming with a RegEx Support 1
R How to? use @everything perl regex Support 2
C v18 regex help please Support 1
C Font of RegEx Analyzer Support 0
D Regex problem Support 17
mikea How to? Regex match when there shouldn't be (?) Support 18
JohnQSmith Fixed Copying with regex (several issues) Support 7
D Help needed to get a regex to work Support 3
thedave WAD Regex match on \h Support 5
Ville Regex & conditionals Support 9
samintz Regex Rename Support 2
vefatica @REGEX: behavior vs. documentation Support 2
vefatica @REGEX revisited Support 4
vefatica @REGEX question Support 6
vefatica Regex question Support 5
B Regex and Replace Support 6
Stefano Piccardi detecting BOM, FFIND multibyte regex Support 18
dcantor FFIND syntax -- is /E"regex" /X supported? Support 2
P Renaming files with regex. Support 6
B "Fun" with DO and Regex Support 12
P Need to use a regex in a "for" loop. Support 54
C Copy (sys) error Support 3
Alpengreis Fixed Crash after copy dialog with big TCC.exception.log Support 5
vefatica Copy/Paste anomaly Support 4

Similar threads