def copy_files_source_to_target(source, target):
 print ('Processing %s' % os.path.join(os.getcwd(), source))
 print ('Copying into %s' % os.path.join(os.getcwd(), target))
 ensure_directory_exists(target)
 shutil.rmtree(target)
 for (root, dirs, files) in os.walk(os.path.join(os.getcwd(), source)):
  for directory in dirs:
   print ('Processing %s' % os.path.join(root, directory))
  for filename in files:
   source_path = os.path.join(root, filename)
   if (target in source_path):
    continue
   if (source not in source_path):
    continue
   target_path = source_path.replace(source, target)
   ensure_directory_exists(target_path)
   shutil.copyfile(source_path, target_path)

def copy_files_source_to_target ( source , target ) : print ( 'Processing %s' % os . path . join ( os . getcwd ( ) , source ) ) print ( 'Copying into %s' % os . path . join ( os . getcwd ( ) , target ) ) ensure_directory_exists ( target ) shutil . rmtree ( target ) for ( root , dirs , files ) in os . walk ( os . path . join ( os . getcwd ( ) , source ) ) : for directory in dirs : print ( 'Processing %s' % os . path . join ( root , directory ) ) for filename in files : source_path = os . path . join ( root , filename ) if ( target in source_path ) : continue if ( source not in source_path ) : continue target_path = source_path . replace ( source , target ) ensure_directory_exists ( target_path ) shutil . copyfile ( source_path , target_path )
copies all files in source directory to target .