Exemple #1
0
def rename_v2(src, dst, overwrite=False):
  """Rename or move a file / directory.

  Args:
    src: string, pathname for a file
    dst: string, pathname to which the file needs to be moved
    overwrite: boolean, if false it's an error for `dst` to be occupied by an
      existing file.

  Raises:
    errors.OpError: If the operation fails.
  """
  pywrap_tensorflow.RenameFile(
      compat.as_bytes(src), compat.as_bytes(dst), overwrite)
Exemple #2
0
def rename(oldname, newname, overwrite=False):
  """Rename or move a file / directory.

  Args:
    oldname: string, pathname for a file
    newname: string, pathname to which the file needs to be moved
    overwrite: boolean, if false its an error for newpath to be occupied by an
        existing file.

  Raises:
    errors.OpError: If the operation fails.
  """
  with errors.raise_exception_on_not_ok_status() as status:
    pywrap_tensorflow.RenameFile(
        compat.as_bytes(oldname), compat.as_bytes(newname), overwrite, status)
Exemple #3
0
def rename(oldname, newname, overwrite=False):
  with errors.raise_exception_on_not_ok_status() as status:
    return pywrap_tensorflow.RenameFile(compat.as_bytes(oldname),
                                        compat.as_bytes(newname), overwrite,
                                        status)