Shortcuts

mmengine.fileio.copyfile_from_local

mmengine.fileio.copyfile_from_local(src, dst, backend_args=None)[source]

Copy a local file src to dst and return the destination file.

Note

If the backend is the instance of LocalBackend, it does the same thing with copyfile().

Parameters
  • src (str or Path) – A local file to be copied.

  • dst (str or Path) – Copy file to dst.

  • backend_args (dict, optional) – Arguments to instantiate the corresponding backend. Defaults to None.

Returns

If dst specifies a directory, the file will be copied into dst using the base filename from src.

Return type

str

Examples

>>> # dst is a file
>>> src = '/path/of/file'
>>> dst = 's3://openmmlab/mmengine/file1'
>>> # src will be copied to 's3://openmmlab/mmengine/file1'
>>> copyfile_from_local(src, dst)
s3://openmmlab/mmengine/file1
>>> # dst is a directory
>>> dst = 's3://openmmlab/mmengine'
>>> # src will be copied to 's3://openmmlab/mmengine/file''
>>> copyfile_from_local(src, dst)
's3://openmmlab/mmengine/file'
Read the Docs v: v0.4.0
Versions
latest
stable
v0.5.0
v0.4.0
v0.3.0
v0.2.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.