def _RecMoveFiles(tempdir, dspath, subpath):
  fulltempdir = utils.JoinPath(tempdir, subpath)
  fulldsdir = utils.JoinPath(dspath, subpath)
  try:
    # The data store must have this directory.
    os.makedirs(fulldsdir)
  except OSError:
    pass
  for fname in os.listdir(fulltempdir):
    if fname in MOVE_EXCEPTIONS:
      # We do not need to move this file.
      continue
    temppath = utils.JoinPath(fulltempdir, fname)
    if os.path.isfile(temppath):
      newpath = utils.JoinPath(fulldsdir, fname)
      logging.info("Moving file %s to %s", temppath, newpath)
      os.rename(temppath, newpath)
    elif os.path.isdir(temppath):
      _RecMoveFiles(tempdir, dspath, utils.JoinPath(subpath, fname))
dataset/ETHPy150Open google/grr/grr/server/data_server/rebalance.py/_RecMoveFiles/original