File

Utilities for manipulating files and paths

Create a hard link, if possible, between a src filepath to a dst filepath, or copy if a link is not possible.

disseminate.utils.file.parents(path)

Generate a list of parent paths for the given path.

Parameters
pathstr

A filepath or directory.

Returns
parentsList[str]

The parents of the path

Examples

>>> parents('/home/jlorieau/Documents/test.txt')
['/home/jlorieau/Documents', '/home/jlorieau', '/home']
>>> parents('tex/chapter1/chapter1.tex')
['tex/chapter1', 'tex']