Skip to content

Expose file size, mode, etc from pathlib.Path.info #139174

@barneygale

Description

@barneygale

Feature or enhancement

Proposal:

As a pathlib user, I desire methods that retrieve the file mode, size, access time and modify time.

We can implement these as methods of Path.info.

    def mode(self, *, follow_symlinks: bool = True) -> int: ...
    def size(self, *, follow_symlinks: bool = True) -> int: ...
    def access_time(self, *, follow_symlinks: bool = True) -> datetime: ...
    def modify_time(self, *, follow_symlinks: bool = True) -> datetime: ...

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

https://discuss.python.org/t/expose-file-size-mode-etc-from-pathlib-path-info/103828

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-pathlibtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions