tf.compat.v1.gfile.Copy

Copies data from src to dst.

with open("/tmp/x", "w") as f:
  f.write("asdf")

4
tf.io.gfile.exists("/tmp/x")
True
tf.io.gfile.copy("/tmp/x", "/tmp/y")
tf.io.gfile.exists("/tmp/y")
True
tf.io.gfile.remove("/tmp/y")

You can also specify the URI scheme for selecting a different filesystem:

with open("/tmp/x", "w") as f:
  f.write("asdf")

4
tf.io.gfile.copy("/tmp/x", "file:///tmp/y")
tf.io.gfile.exists("/tmp/y")
True
tf.io.gfile.remove("/tmp/y")

Note that you need to always specify a file name, even if moving into a new directory. This is because some cloud filesystems don't have the concept of a directory.

with open("/tmp/x", "w") as f: