1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Simple RegEx copy

Discussion in 'Support' started by pb4072, Aug 30, 2016.

  1. pb4072

    Joined:
    Jul 25, 2008
    Messages:
    33
    Likes Received:
    0
    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. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    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. pb4072

    Joined:
    Jul 25, 2008
    Messages:
    33
    Likes Received:
    0
    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. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    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
     
  5. pb4072

    Joined:
    Jul 25, 2008
    Messages:
    33
    Likes Received:
    0
    Hey! That worked! Yes, I just needed the drive letter there. Thanks a lot!
     
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,026
    Likes Received:
    84
    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.)
     
  7. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    ... 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).
     
  8. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,026
    Likes Received:
    84
    So -- you don't want UNC support with RE's?
     
  9. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    I'd expect it to look like this inside a RE.
    Code:
    ::\\\\host\\share\\...
     
  10. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,026
    Likes Received:
    84
    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.
     

Share This Page