Warning: This document is for the development version of Bareos Documentation. The main version is bareos-21.

bareos.util.path.Path

class bareos.util.path.Path(path=None)[source]

Bases: object

Class to handle file paths.

Parameters

path (str, optional) – string representation of the file system path.

Methods

get

is_directory

is_root

len

remove

set_path

shift

Removes the first component of the path.

shift()[source]

Removes the first component of the path.

Example

>>> path = Path("/usr/bin/python")
>>> path.shift()
'usr'
>>> print(path)
/bin/python
Returns

First component of the path.

Return type

str

Raises

IndexError – if path can’t be shifted (path is empty).