def mergeFolder(src, dst, pattern=None):
 srcnames = os.listdir(src)
 for name in srcnames:
  srcfname = os.path.join(src, name)
  dstfname = os.path.join(dst, name)
  if os.path.isdir(srcfname):
   if (not os.path.isdir(dstfname)):
    os.makedirs(dstfname)
   mergeFolder(srcfname, dstfname)
  else:
   try:
    shutil.copyfile(srcfname, dstfname)
   except IOError as why:
    print why

def mergeFolder ( src , dst , pattern = None ) : srcnames = os . listdir ( src ) for name in srcnames : srcfname = os . path . join ( src , name ) dstfname = os . path . join ( dst , name ) if os . path . isdir ( srcfname ) : if ( not os . path . isdir ( dstfname ) ) : os . makedirs ( dstfname ) mergeFolder ( srcfname , dstfname ) else : try : shutil . copyfile ( srcfname , dstfname ) except IOError as why : print why
merge a folder into another .