cf.relpath¶
-
cf.
relpath
(filename, start=None)[source]¶ Return a relative filepath to a file.
The filepath is relative either from the current directory or from an optional start point.
If a string containing URL is provided then it is returned unchanged.
See also
Parameters: Returns: str
The relative path.
Examples:
>>> cf.relpath('/data/archive/file.nc') '../file.nc' >>> cf.relpath('/data/archive///file.nc', start='/data') 'archive/file.nc' >>> cf.relpath('http://data/archive/file.nc') 'http://data/archive/file.nc'