ospathcommonprefixpaths
Ospathcommonprefixpaths is a utility that computes the longest shared directory prefix among a set of filesystem paths. Given an iterable of path names, it returns the deepest path that is a prefix of every input, according to the operating system's path semantics. The function is useful for discovering a common root, organizing files by location, and simplifying relative-path calculations.
In practice, the function normalizes each path (for example with normpath and, if appropriate, abspath), splits
Relation to the Python standard library: the concept is close to os.path.commonpath, which returns the true
Example: ospathcommonprefixpaths(['/home/alice/project/src', '/home/alice/project/docs', '/home/alice/project/tests']) yields '/home/alice/project'. See also commonpath and commonprefix.