def copy_file_to_dir_if_newer(sourcefile, destdir):
 destfile = os.path.join(destdir, os.path.basename(sourcefile))
 try:
  desttime = modification_time(destfile)
 except OSError:
  safe_makedirs(destdir)
 else:
  if (not file_newer_than(sourcefile, desttime)):
   return
 shutil.copy2(sourcefile, destfile)

def copy_file_to_dir_if_newer ( sourcefile , destdir ) : destfile = os . path . join ( destdir , os . path . basename ( sourcefile ) ) try : desttime = modification_time ( destfile ) except OSError : safe_makedirs ( destdir ) else : if ( not file_newer_than ( sourcefile , desttime ) ) : return shutil . copy2 ( sourcefile , destfile )
copy file sourcefile to directory destdir .