Skip to content

Metadata

Metadata about a single filesystem entry.

Returned by metadata, Path.metadata, and File.metadata. For filesystem-level capacity and mount metadata, use FsMetadata.

Accessing a field that does not apply to the target platform raises FieldError. freebsd_attrs, linux_attrs, macos_attrs, and related attribute fields are nil when the filesystem or file type does not support querying file attributes.

Fields

accessed @ time.DateTime

Last access time.

append_only @ Bool

Whether the platform append-only flag is set.

archive @ Bool

Whether the archive attribute is set. Windows only.

blksize @ Int

Preferred block size for I/O. Unix only.

blocks @ Int

Number of allocated 512-byte blocks. Unix only.

casefold @ Bool

Whether the case-insensitive-directory-lookups flag is set. Linux only.

compressed @ Bool

Whether the platform compressed flag is set.

created @ time.DateTime

Creation or status-change time.

data_journaling @ Bool

Whether the data-journaling flag is set. Linux only.

dev @ Int

Device ID. Unix only.

dir_sync @ Bool

Whether the synchronous-directory-updates flag is set. Linux only.

direct_access @ Bool

Whether the direct-access flag is set. Linux only.

encrypted @ Bool

Whether the encrypted attribute is set. Windows only.

extent_format @ Bool

Whether the extent-format flag is set. Linux only.

freebsd_attrs @ Int

Raw FreeBSD file flags. FreeBSD only.

gid @ Int

Owner group ID. Unix only.

group

Owning group: the gid as an Int on Unix, or the primary group Sid on Windows.

This representation matches the group argument accepted by update_metadata.

hidden @ Bool

Whether the platform hidden flag is set.

immutable @ Bool

Whether the platform immutable flag is set.

ino @ Int

Inode number. Unix only.

linux_attrs @ Int

Raw Linux attribute flags. Linux only.

macos_attrs @ Int

Raw macOS file flags. macOS only.

mode @ fs.unix.Mode

Permissions and file type. Unix only.

modified @ time.DateTime

Last modification time.

nlink @ Int

Hard-link count. Unix only.

no_atime @ Bool

Whether the no-atime flag is set. Linux only.

no_compress @ Bool

Whether the don't-compress flag is set. Linux only.

no_copy_on_write @ Bool

Whether the no-copy-on-write flag is set. Linux only.

no_dump @ Bool

Whether the platform no-dump flag is set.

no_tail_merge @ Bool

Whether the no-tail-merging flag is set. Linux only.

not_content_indexed @ Bool

Whether the not-content-indexed attribute is set. Windows only.

offline @ Bool

Whether the offline attribute is set. Windows only.

opaque @ Bool

Whether the opaque flag is set. macOS only.

owner

Owner: the uid as an Int on Unix, or the owner Sid on Windows.

This representation matches the owner argument accepted by update_metadata.

project_inherit @ Bool

Whether the project-hierarchy flag is set. Linux only.

rdev @ Int

Special-device ID. Unix only.

readonly @ Bool

Whether the readonly attribute is set. Windows only.

reparse_point @ Bool

Whether the reparse-point attribute is set. Windows only.

secure_delete @ Bool

Whether the secure-deletion flag is set. Linux only.

size @ Int

File size in bytes.

sparse @ Bool

Whether sparse allocation is enabled. Windows only.

sync @ Bool

Whether the synchronous-updates flag is set. Linux only.

system @ Bool

Whether the system attribute is set. Windows only.

temporary @ Bool

Whether the temporary attribute is set. Windows only.

top_dir @ Bool

Whether the top-of-directory-hierarchy flag is set. Linux only.

type @ FileType

File type.

uid @ Int

Owner user ID. Unix only.

undelete @ Bool

Whether the undeletable flag is set. Linux only.

win_attrs @ Int

Raw Windows file attribute bitmask. Windows only.