copy_file

hep_rfm.copy_file(source, target, wdir=None, loglock=None, modifiers=None)[source]

Main function to copy a file from a source to a target. The copy is done if the modification time of both files do not coincide. Since sometimes the files are very large, in this case it is recommendable to specify a directory to copy the temporal files “wdir”, so files can be copied on disk.

Parameters:
  • source (ProtocolPath) – where to copy the file from.
  • target (ProtocolPath) – where to copy the file.
  • wdir (str) – where to create the possible temporary directory. The option is passed to tempfile.TemporaryDirectory as “dir”.
  • loglock (multiprocessing.Lock or None) – possible locker to prevent from displaying at the same time in the screen for two different processes.
  • modifiers (dict) – dictionary with the information to modify the path of the input hep_rfm.ProtocolPath instances.
Raises:

CopyFileError – if the file can not be copied.

Note

If source and target point to the same file, no copy will be done.