Skip to main content
Warning Some features may not work without JavaScript. Please try enabling it if you encounter problems.

Developer utility to generate and verify pathnames

Project description

About

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.

Installation

pip3 install batchpath

The 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.

Usage

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

License

Copyright (c) 2015 Six (brbsix@gmail.com).

Licensed under the GPLv3 license.

Project details


Release history Release notifications | RSS feed

This version

0.2

Download files

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

Source Distribution

batchpath-0.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

batchpath-0.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file batchpath-0.2.tar.gz.

File metadata

  • Download URL: batchpath-0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for batchpath-0.2.tar.gz
Algorithm Hash digest
SHA256 e9d6c15d9ec93a2f71cc098502c7efa06b54a49c174998379083ff17b4733086
MD5 c62ab11ff15aa9687add9ca77e1f4451
BLAKE2b-256 6e1e813de6bd550ece4456da73b2d8b20f68a1c78d422deac89fb1a5b65d1dba

See more details on using hashes here.

File details

Details for the file batchpath-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for batchpath-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 deece446c75e39c69f00cf3330b34af5bdf75ca19accd821b24cbe3e10b148bd
MD5 d3b10990e3a34d5c18e0504971740d78
BLAKE2b-256 54de1d839e02d93a307726e7fe2c6b0c1e001583d9d9fb2a95c3d6dc08ba8cc1

See more details on using hashes here.

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