objectstore: add clone method for object
Right now this is basically a clone(!) of `export` but this will change in the future when we change the layout of how objects are stored.
This commit is contained in:
parent
c3c06a1ebd
commit
1762048c1f
1 changed files with 14 additions and 0 deletions
|
|
@ -184,6 +184,20 @@ class Object:
|
|||
check=True,
|
||||
)
|
||||
|
||||
def clone(self, to_directory: PathLike):
|
||||
"""Clone the object to the specified directory"""
|
||||
with self.read() as from_directory:
|
||||
subprocess.run(
|
||||
[
|
||||
"cp",
|
||||
"--reflink=auto",
|
||||
"-a",
|
||||
os.fspath(from_directory) + "/.",
|
||||
os.fspath(to_directory),
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
|
||||
|
||||
class HostTree:
|
||||
"""Read-only access to the host file system
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue