monkey_wrench.input_output._common module

monkey_wrench.input_output._common.copy_files_between_directories(source_directory: ~typing.Annotated[~pathlib.Path, ~pydantic.types.PathType(path_type=dir), ~pydantic.functional_validators.AfterValidator(func=~monkey_wrench.input_output._types.<lambda>)], destination_directory: ~typing.Annotated[~pathlib.Path, ~pydantic.types.PathType(path_type=dir), ~pydantic.functional_validators.AfterValidator(func=~monkey_wrench.input_output._types.<lambda>)], pattern: ~monkey_wrench.generic.models._pattern.Pattern | None = None) None[source]

Copy (top-level) files whose names include the pattern from one directory to another.

Warning

The copying is not performed recursively. Only the top-level files are copied.

Parameters:
  • source_directory – The source directory to copy files from.

  • destination_directory – The destination directory to copy files to.

  • pattern – The pattern to filter the files.

monkey_wrench.input_output._common.copy_single_file_to_directory(destination_directory: ~typing.Annotated[~pathlib.Path, ~pydantic.types.PathType(path_type=dir), ~pydantic.functional_validators.AfterValidator(func=~monkey_wrench.input_output._types.<lambda>)], filepath: ~typing.Annotated[~pathlib.Path, ~pydantic.types.PathType(path_type=file), ~pydantic.functional_validators.AfterValidator(func=~monkey_wrench.input_output._types.<lambda>)]) None[source]

Copy a single file with the given path to another destination directory.

Parameters:
  • destination_directory – The destination directory to copy the given file to.

  • filepath – The path of the file that needs to be copied.