Simple RegEx copy

#1
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
 
#2
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
 
#3
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
 
#4
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
 
#7
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
10,619
97
#10
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.