fluentfs.paths.paths.relative_path

fluentfs.paths.paths.relative_path(path: str, base_path: Optional[str] = None) str

Get the path relative to a base path.

Examples: * relative_path(“/home/username/somedir/a.txt”, “/home/username/somedir”) returns “a.txt” * relative_path(“/home/username/somedir/a.txt”, “/home/username”) returns “somedir/a.txt”

Parameters:
  • path – The given path.

  • base_path – The base path.

Returns:

The relative path.