A PathInfo object that exposes the file type and other file attributes of this path.
>>> p = Path('src') >>> if p.info.is_symlink(): ... print('symlink') ... elif p.info.is_dir(): ... print('directory') ... elif p.info.exists(): ... print('something else') ... else: ... print('not found') ... directory
pathlib/Path.info
Path.info