uwtools.api.file

API access to uwtools file-management tools.

uwtools.api.file.copy(target_dir: Union[Path, str], config: Optional[Union[dict, Path, str]] = None, cycle: Optional[datetime] = None, leadtime: Optional[timedelta] = None, keys: Optional[List[str]] = None, dry_run: bool = False, stdin_ok: bool = False) bool

Copy files.

Parameters
  • target_dir – Path to target directory

  • config – YAML-file path, or dict (read stdin if missing or None).

  • cycle – A datetime object to make available for use in the config.

  • leadtime – A timedelta object to make available for use in the config.

  • keys – YAML keys leading to file dst/src block

  • dry_run – Do not copy files

  • stdin_ok – OK to read from stdin?

Returns

True if no exception is raised

Link files.

Parameters
  • target_dir – Path to target directory

  • config – YAML-file path, or dict (read stdin if missing or None).

  • cycle – A datetime object to make available for use in the config.

  • leadtime – A timedelta object to make available for use in the config.

  • keys – YAML keys leading to file dst/src block

  • dry_run – Do not link files

  • stdin_ok – OK to read from stdin?

Returns

True if no exception is raised