Skip to main content

recursive filesystem object

Project description

filesystem_autocomplete

PyPI

tests

codecov

utility for recursively mapping files and subdirectories

To use, import walk_directory then supply a starting directory:

>>> from filesystem_autocomplete import walk_directory
>>> dir_info = walk_directory(".")

The resulting object will contain attributes for all files and subdirectories.

From a python shell or jupyter notebook, you can explore the file system using autocomplete. When evaluating, files will print their full path:

>>> dir_info.filesystem_autocomplete.filesystem_autocomplete_py
/home/chavlin/src/dxl/filesystem_autocomplete/filesystem_autocomplete/filesystem_autocomplete.py

directories will print their contents:

>>> dir_info.filesystem_autocomplete
Directory: /home/chavlin/src/dxl/filesystem_autocomplete/filesystem_autocomplete

Files:
__init__.py
filesystem_autocomplete.py

Subdirectories:
__pycache__
tests

To extract the full path for files:

>>> dir_info.filesystem_autocomplete.filesystem_autocomplete_py.filepath
'/home/chavlin/src/dxl/filesystem_autocomplete/filesystem_autocomplete/filesystem_autocomplete.py'

and for directories:

>>> dir_info.filesystem_autocomplete.dirpath
'/home/chavlin/src/dxl/filesystem_autocomplete/filesystem_autocomplete'

handling special characters

Since files and directories are stored as attributes, any invalid characters are replaced with underscores in the object. The full path string contains the original file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

filesystem_autocomplete-0.1.0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

filesystem_autocomplete-0.1.0-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page