fs.copy

Copying files from one filesystem to another.

Functions for copying resources between filesystem.

fs.copy.copy_dir(src_fs, src_path, dst_fs, dst_path, walker=None)

Copy a directory from one filesystem to another.

参数:
  • src_fs (FS URL or instance) – Source filesystem.
  • src_path (str) – A path to a directory on src_fs.
  • dst_fs (FS URL or instance) – Destination filesystem.
  • dst_path (str) – A path to a directory on dst_fs.
  • walker (Walker) – A walker object that will be used to scan for files in src_fs. Set this if you only want to consider a sub-set of the resources in src_fs.
fs.copy.copy_file(src_fs, src_path, dst_fs, dst_path)

Copy a file from one filesystem to another.

If the destination exists, and is a file, it will be first truncated.

参数:
  • src_fs (FS URL or instance) – Source filesystem.
  • src_path (str) – Path to a file on src_fs.
  • dst_fs (FS URL or instance) – Destination filesystem.
  • dst_path (str) – Path to a file on dst_fs.
fs.copy.copy_fs(src_fs, dst_fs, walker=None)

Copy the contents of one filesystem to another.

参数:
  • src_fs – Source filesystem.
  • src_path (str) – A path to a directory on src_fs.
  • dst_fs (FS URL or instance) – Destination filesystem.
  • walker (Walker) – A walker object that will be used to scan for files in src_fs. Set this if you only want to consider a sub-set of the resources in src_fs.
fs.copy.copy_structure(src_fs, dst_fs, walker=None)

Copy directories (but not files) from src_fs to dst_fs.

参数:
  • src_fs (FS URL or instance) – Source filesystem.
  • dst_fs (FS URL or instance) – Destination filesystem.
  • walker (Walker) – A walker object that will be used to scan for files in src_fs. Set this if you only want to consider a sub-set of the resources in src_fs.