Developer utility to generate and verify pathnames
This module is sort of like os.walk on steroids. It was created to allow the safe use of command-line path arguments in your Python scripts. For instance, say the user passes in several files and directories as arguments and you want to return a sorted list of files within said directories meeting specific access, extension, and/or size criteria. Or perhaps the user passes in a list of files and you want to verify that all of the files meet the necessary criteria before using them.
pip3 install batchpath
batchpath module is known to be compatible with Python 3.
NOTE: This module uses os.walk(), but will use scandir’s significantly faster implementation if it is available. Consider installing the scandir module.
from batchpath import GeneratePaths() gp = GeneratePaths() paths = ['/path/to/directory'] files = gp.files(paths, access=os.R_OK, extensions=['conf','txt'], minsize=0, recursion=True)
from batchpath import VerifyPaths() vp = VerifyPaths() paths = ['/path/to/file', '/path/to/dir', '/path/to/other'] verification_status = vp.all(paths, access=os.R_OK) invalid_paths = vp.failures
Copyright (c) 2015 Six (email@example.com).
Licensed under the GPLv3 license.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|batchpath-0.2-py3-none-any.whl (5.2 kB) Copy SHA256 hash SHA256||Wheel||py3||Feb 3, 2015|
|batchpath-0.2.tar.gz (3.4 kB) Copy SHA256 hash SHA256||Source||None||Feb 3, 2015|