zut.files.archivate

zut.files.archivate(path: str | PathLike, archive_dir: bool | str | PathLike | Path | None = None, *, missing_ok: bool = False, keep: bool = False) str | None

Archivate path to archive_dir directory (or zip entry), ensuring unique archive name.

Parameters:
  • archive_dir – By default (if None), use the same directory as the origin path. If relative (e.g. ‘archive’), it is relative to the directory of the original path.

  • missing_ok – If True, do not throw an exception if the original file does not exist.

  • keep – If True, the original file is not removed after archiving.