def copy(src, dst, createpath=0, copydates=1, forcetype=None):
 src = File.pathname(src)
 dst = File.pathname(dst)
 if createpath:
  mkdirs(os.path.split(dst)[0])
 ifp = open(src, 'rb')
 ofp = open(dst, 'wb')
 d = ifp.read(BUFSIZ)
 while d:
  ofp.write(d)
  d = ifp.read(BUFSIZ)
 ifp.close()
 ofp.close()
 ifp = openrf(src, '*rb')
 ofp = openrf(dst, '*wb')
 d = ifp.read(BUFSIZ)
 while d:
  ofp.write(d)
  d = ifp.read(BUFSIZ)
 ifp.close()
 ofp.close()
 srcfss = File.FSSpec(src)
 dstfss = File.FSSpec(dst)
 sf = srcfss.FSpGetFInfo()
 df = dstfss.FSpGetFInfo()
 (df.Creator, df.Type) = (sf.Creator, sf.Type)
 if (forcetype is not None):
  df.Type = forcetype
 df.Flags = (sf.Flags & COPY_FLAGS)
 dstfss.FSpSetFInfo(df)
 if copydates:
  srcfsr = File.FSRef(src)
  dstfsr = File.FSRef(dst)
  (catinfo, _, _, _) = srcfsr.FSGetCatalogInfo(Files.kFSCatInfoAllDates)
  dstfsr.FSSetCatalogInfo(Files.kFSCatInfoAllDates, catinfo)

def copy ( src , dst , createpath = 0 , copydates = 1 , forcetype = None ) : src = File . pathname ( src ) dst = File . pathname ( dst ) if createpath : mkdirs ( os . path . split ( dst ) [ 0 ] ) ifp = open ( src , 'rb' ) ofp = open ( dst , 'wb' ) d = ifp . read ( BUFSIZ ) while d : ofp . write ( d ) d = ifp . read ( BUFSIZ ) ifp . close ( ) ofp . close ( ) ifp = openrf ( src , '*rb' ) ofp = openrf ( dst , '*wb' ) d = ifp . read ( BUFSIZ ) while d : ofp . write ( d ) d = ifp . read ( BUFSIZ ) ifp . close ( ) ofp . close ( ) srcfss = File . FSSpec ( src ) dstfss = File . FSSpec ( dst ) sf = srcfss . FSpGetFInfo ( ) df = dstfss . FSpGetFInfo ( ) ( df . Creator , df . Type ) = ( sf . Creator , sf . Type ) if ( forcetype is not None ) : df . Type = forcetype df . Flags = ( sf . Flags & COPY_FLAGS ) dstfss . FSpSetFInfo ( df ) if copydates : srcfsr = File . FSRef ( src ) dstfsr = File . FSRef ( dst ) ( catinfo , _ , _ , _ ) = srcfsr . FSGetCatalogInfo ( Files . kFSCatInfoAllDates ) dstfsr . FSSetCatalogInfo ( Files . kFSCatInfoAllDates , catinfo )
copy files from one location to another .