xcp_d.utils.filemanip.copyfile
- xcp_d.utils.filemanip.copyfile(originalfile, newfile, copy=False, create_new=False, hashmethod=None, use_hardlink=False, copy_related_files=True)[source]
Copy or link
originalfile
tonewfile
.If
use_hardlink
is True, and the file can be hard-linked, then a link is created, instead of copying the file.If a hard link is not created and
copy
is False, then a symbolic link is created.- Parameters:
originalfile (
str
) – full path to original filenewfile (
str
) – full path to new filecopy (bool) – specifies whether to copy or symlink files (default=False) but only for POSIX systems
use_hardlink (bool) – specifies whether to hard-link files, when able (Default=False), taking precedence over copy
copy_related_files (bool) – specifies whether to also operate on related files, as defined in
related_filetype_sets
- Returns:
newfile – The full path to the new file.
- Return type: