title: How to copy multiple files using wild cards in Python?
body: <p>I'm trying to copy files from one folder to another using multiple source locations and wildcards as a part of filenames, but for some reason <code>glob.glob</code> is not working as I have expected (there are only single files per wildcard but version of the snapshot is changing) - getting an error <code>need string or buffer, list found</code>.</p>
  
  <p>Part of the python code for that looks like:</p>
  
  <pre><code>content=[]
  tomcatFiles=[]
  
  def addToContent(srcFile, destFile):
      info={'src': srcFile, 'dest': destFile}
      content.append(info)
  
  def addToTomcatFile(srcFile, destFile):
      info={'src': srcFile, 'dest': destFile}
      tomcatFiles.append(info)
  
  def main():
      baseDir=sys.argv[1]
      intellijProjDir=sys.argv[2]
  
      deploy_dir=baseDir+'/TransferFiles'
      working_dir=intellijProjDir
      tomcatDir=deploy_dir+"/tomcat"
  
      addToTomcatFile('/project1/target/project1*.war', '/tomcat/project1.war')
      addToTomcatFile('/project2/target/project2*.war', '/tomcat/project2.war')
      addToTomcatFile('/projectX/target/projectX*.war', '/tomcat/projectX.war')
  
      for infoObj in tomcatFiles:
          addToContent(infoObj['src'], infoObj['dest'])
  
      for infoObj in content:
          shutil.copy2(glob.glob(working_dir + infoObj['src']), deploy_dir + infoObj['dest'])
          print('Copied ' + infoObj['dest'])
  </code></pre>