| [ Web Proxy ] |
| Viewing: https://arrow.apache.org/docs/python/generated/pyarrow.fs.FileSelector.html | [Back] [Original] |
Section Navigation
Bases: _Weakrefable
File and directory selector.
It contains a set of options that describes how to search for files and directories.
strThe directory in which to select files. Relative paths also work, use . for the current directory and .. for the parent.
FalseThe behavior if base_dir doesnt exist in the filesystem. If false, an error is returned. If true, an empty selection is returned.
FalseWhether to recurse into subdirectories.
Examples
List the contents of a directory and subdirectories:
>>> selector_1 = fs.FileSelector(local_path, recursive=True)
>>> local.get_file_info(selector_1)
[<FileInfo for 'tmp/alphabet/example.dat': type=FileType.File, size=4>,
<FileInfo for 'tmp/alphabet/subdir': type=FileType.Directory>,
<FileInfo for 'tmp/alphabet/subdir/example_copy.dat': type=FileType.File, size=4>]
List only the contents of the base directory:
>>> selector_2 = fs.FileSelector(local_path)
>>> local.get_file_info(selector_2)
[<FileInfo for 'tmp/alphabet/example.dat': type=FileType.File, size=4>,
<FileInfo for 'tmp/alphabet/subdir': type=FileType.Directory>]
Return empty selection if the directory doesnt exist:
>>> selector_not_found = fs.FileSelector(local_path + '/missing',
... recursive=True,
... allow_not_found=True)
>>> local.get_file_info(selector_not_found)
[]
Methods
|
Attributes
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 |