new_file_to_archive
- specatalog.data_management.measurement_management.new_file_to_archive(src, base_dir, ms_id, category, update=False)[source]
Copy a file to the archive. The file is saved at: <base_dir>/data/M<ms_id>/<category>/<src_file_name>.
- Parameters:
src (str or Path) – Path of the file that is to be saved in the archive.
base_dir (str or Path) – Path to the root-folder of the archive.
ms_id (str or int) – Number of the measurement.
category (str) – One of the categories: [“raw”, “scripts”, “figures”, “additional_info”, “literature”]. The file is copied to the corresponding subfolder.
update (bool, optional) – If set to false an error is risen in case the file aleardy exists. The default is False.
- Raises:
ValueError – An error is raised if the category is not one out of the list: [“raw”, “scripts”, “figures”, “additional_info”, “literature”].
FileNotFoundError – An error is raised if the source file does not exist.
FileExistsError – An error is raised if the target file exists and update=False.
- Return type:
None.