READ ME
This is a very simple package which is basically a wrapper around glob; it simply gets all the files with extension matching a list of extensions in a given directory. I found that I was including functionality like this in so many other projects I might as well just make it a package. Plus I wanted to play with poetry.
install
pip install get_all_files
Examples
get all jpg files in home directory
from get_all_files import get_all_files
from pathlib import Path
home_dir = Path('~').expanduser()
jpg_files = get_all_files(home_dir, 'jpg')
get all jpg AND png files in home directory
from get_all_files import get_all_files
from pathlib import Path
home_dir = Path('~').expanduser()
jpg_files = get_all_files(home_dir, ['jpg', 'png'])
get all jpg files starting with 'a' in home directory
from get_all_files import get_all_files
from pathlib import Path
home_dir = Path('~').expanduser()
jpg_files = get_all_files(home_dir, 'jpg', file_name='a*')
get absolute file paths instead of file names
from get_all_files import get_all_files
from pathlib import Path
home_dir = Path('~').expanduser()
jpg_files = get_all_files(home_dir, ['jpg', 'png'], return_absolute_filepath=True)
Loop over multiple directories
This package is not recursive - if you want to process multiple directories you have to do it yourself:
from get_all_files import get_all_files
from pathlib import Path
import os
home_dir = Path('~').expanduser()
subfolders = [f.path for f in os.scandir(home_dir) if f.is_dir()]
extension = 'txt' # why not
all_files = []
for folder in subfolders:
files = get_all_files(folder, extension, return_absolute_filepath=True)
all_files.extend(files)
Metadata
Release files for get-all-files 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| get_all_files-0.3.0.tar.gz | 3.3 kB | Without provenance | Details for get_all_files-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| get_all_files-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for get_all_files-0.3.0-py3-none-any.whl |
Total release size: 7.4 kB
Release files / get_all_files-0.3.0.tar.gz
| Download URL | get_all_files-0.3.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe8b859e7218dc440f1a441f66e64ec50580daee27fc7d26b2bc7b87bd9cfe8b
|
|
BLAKE2b-256 checksum How to use checksums |
fb9cb84751b7306e292c798b93edad2c7a09fc7876b79bdcc51457773f1c2c89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / get_all_files-0.3.0-py3-none-any.whl
| Download URL | get_all_files-0.3.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05243d9cb2f48657d667b672a2bf14687e955c526aba7fc2e53545cd8d17b7ba
|
|
BLAKE2b-256 checksum How to use checksums |
43a8409078b8744a0de6c66383d9443631fc99a56fbd5cccd68ba3d122780da2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for get-all-files 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.