| [ Web Proxy ] |
| Viewing: https://arrow.apache.org/docs/python/api/../../cpp/../python/generated/pyarrow.fs.FileInfo.html | [Back] [Original] |
Section Navigation
Bases: _Weakrefable
FileSystem entry info.
strThe full path to the filesystem entry.
FileTypeThe type of the filesystem entry.
datetime or float, default NoneIf given, the modification time of the filesystem entry. If a float is given, it is the number of seconds since the Unix epoch.
int, default NoneIf given, the modification time of the filesystem entry, in nanoseconds since the Unix epoch. mtime and mtime_ns are mutually exclusive.
int, default NoneIf given, the filesystem entry size in bytes. This should only be given if type is FileType.File.
Examples
Generate a file:
>>> from pyarrow import fs
>>> local = fs.LocalFileSystem()
>>> path_fs = local_path + '/pyarrow-fs-example.dat'
>>> with local.open_output_stream(path_fs) as stream:
... stream.write(b'data')
4
Get FileInfo object using get_file_info():
>>> file_info = local.get_file_info(path_fs)
>>> file_info
<FileInfo for '.../pyarrow-fs-example.dat': type=FileType.File, size=4>
Inspect FileInfo attributes:
>>> file_info.type
<FileType.File: 2>
>>> file_info.is_file
True
>>> file_info.path
'/.../pyarrow-fs-example.dat'
>>> file_info.base_name
'pyarrow-fs-example.dat'
>>> file_info.size
4
>>> file_info.extension
'dat'
>>> file_info.mtime
datetime.datetime(2022, 6, 29, 7, 56, 10, 873922, tzinfo=datetime.timezone.utc)
>>> file_info.mtime_ns
1656489370873922073
Methods
|
Attributes
The file base name. |
|
The file extension. |
|
The time of last modification, if available. |
|
The time of last modification, if available, expressed in nanoseconds since the Unix epoch. |
|
The full file path in the filesystem. |
|
The size in bytes, if available. |
|
Type of the file. |
The file base name.
Component after the last directory separator.
Examples
>>> file_info = local.get_file_info(path)
>>> file_info.base_name
'pyarrow-fs-example.dat'
The file extension.
Examples
>>> file_info = local.get_file_info(path)
>>> file_info.extension
'dat'
The time of last modification, if available.
datetime.datetime or NoneExamples
>>> file_info = local.get_file_info(path)
>>> file_info.mtime
datetime.datetime(2022, 6, 29, 7, 56, 10, 873922, tzinfo=datetime.timezone.utc)
The time of last modification, if available, expressed in nanoseconds since the Unix epoch.
Examples
>>> file_info = local.get_file_info(path)
>>> file_info.mtime_ns
1656489370873922073
The full file path in the filesystem.
Examples
>>> file_info = local.get_file_info(path)
>>> file_info.path
'/.../pyarrow-fs-example.dat'
The size in bytes, if available.
Only regular files are guaranteed to have a size.
Type of the file.
The returned enum values can be the following:
FileType.NotFound: target does not exist
FileType.Unknown: target exists but its type is unknown (could be a special file such as a Unix socket or character device, or Windows NUL / CON / )
FileType.File: target is a regular file
FileType.Directory: target is a regular directory
FileType
Copyright 2016-2026 Apache Software Foundation.
Apache Arrow, Arrow, Apache, the Apache logo, and the Apache Arrow project logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.
Created using Sphinx 9.1.0.
Built with the PyData Sphinx Theme 0.20.0.
| Web Proxy Viewer | New URL | Original Page |