real_rel_path#

real_rel_path(path: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path], start: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path]) Union[cloudpathlib.cloudpath.CloudPath, pathlib.Path][source]#

Gives the real relative path from a starting folder. (and not just adding ../.. between the start and the target)

>>> path = r'D:/_SERTIT_UTILS/sertit-utils/sertit'
>>> start = os.path.join(".", "..", "..")
>>> real_rel_path(path, start)
'sertit-utils/sertit'
Parameters
  • path (Union[str, CloudPath, Path]) – Path to make relative

  • start (Union[str, CloudPath, Path]) – Start, the path being relative from this folder.

Returns

Relative path