caterva2.File.move#

File.move(dst)#

Move a file to a new location.

Parameters:

dst (Path) – The destination path of the file.

Returns:

The new path of the file.

Return type:

Path

Examples

>>> import caterva2 as cat2
>>> # For moving a file you need to be a registered user
>>> urlbase = 'https://cat2.cloud/demo'
>>> root = cat2.Root('@personal', urlbase, dict(username='user@example.com', password='foo'))
>>> root.upload('root-example/dir2/ds-4d.b2nd')
<Dataset: @personal/root-example/dir2/ds-4d.b2nd>
>>> file = root['root-example/dir2/ds-4d.b2nd']
>>> file.move('@personal/root-example/dir1/ds-4d-moved.b2nd')
PosixPath('@personal/root-example/dir1/ds-4d-moved.b2nd')
>>> 'root-example/dir2/ds-4d.b2nd' in root
False
>>> 'root-example/dir1/ds-4d-moved.b2nd' in root
True