title: WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: '\\\\buildloc\\kernel\\*.patch/*.*'
body: <p>I am trying to copy *.patch files from kernel folder and running into following error</p>
  
  <pre><code> Traceback (most recent call last):
    File "copytest.py", line 47, in &lt;module&gt;
      main()
    File "copytest.py", line 44, in main
      copystuff(src,dest)
    File "copytest.py", line 18, in copystuff
      shutil.copytree(src, dest)
    File "C:\CRMApps\apps\Python262\lib\shutil.py", line 140, in copytree
      names = os.listdir(src)
  WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: '\\\\buildloc\\kernel\\*.patch/*.*' 
  </code></pre>
  
  <p>CODE:-</p>
  
  <pre><code>import argparse
  import shutil, errno
  import os
  def copystuff(src, dest):
      #print "IN COPY STUFF"
      if os.path.isfile(src):
          dest_dirname = os.path.dirname(dest)
          #print "DEST DIR NAME" + dest_dirname
          if not os.path.isdir(dest_dirname):
             # print "MAKING DEST DIR"
              os.makedirs(dest_dirname)
          print src
          print dest
          shutil.copy2(src, dest)
      else:
          print src
          print dest
          shutil.copytree(src, dest)
  
  def main ():
      copy_list=[r'\kernel\*.patch']
      #copy_list=['out\target\product\msm8226\obj\KERNEL_OBJ\vmlinux']
      parser = argparse.ArgumentParser(description='This is copy binaries for android build script)
      parser.add_argument('-v','--build_version',action='store',dest='build_version',help='&lt;Required&gt; Build version',required=True)
      parser.add_argument('-s','--source',action='store',dest='source',help='&lt;Required&gt; source path',required=True)
      parser.add_argument('-d','-destination',action='store',dest='destination',help='&lt;Required&gt;destination path',required=True)
      results = parser.parse_args()# collect cmd line args
      build_version = results.build_version
      print "BUILD_VERSION: " + build_version
      source = results.source
      print "SOURCE PATH: " + source
      destination = results.destination
      print "DESTINATION PATH: " + destination
      dest_fastboot=  destination + r'\out\target\product\msm8226'
      if not os.path.isdir(dest_fastboot):
          # print "MAKING DEST DIR"
          os.makedirs(dest_fastboot)
          shutil.copy2('Fastboot_load.bat', dest_fastboot)
      for item in copy_list:
          item = item.strip()
          print "ITEM: " + item
          src = source + item
          dest = destination + item
          copystuff(src,dest)
  
  if __name__ == '__main__':
      main()
  </code></pre>