dirname

dirname(path)

Get the root directory of a file or folder

Args: path (str | List[str]): Path to the file or a list of paths to files

Returns: the directory of the file or a list of directories of the files in case path is a list

Examples: >>> from rlike import * >>> x = dirname(‘/home/xyz/mydata.pickle’) >>> x ‘/home/xyz’ >>> x = dirname([‘/home/xyz/mydata.pickle’, ‘/home/xyz/mydata2.pickle’]) >>> x [‘/home/xyz’, ‘/home/xyz’] >>> x = tempfile() >>> d = dirname(x)