Provides a directory with all its parent directories, if it does not yet exist
Project description
provide_directory
Function to create the given path, including potential parent directories. Returns a bool if at leas one directory as been created.
Dependencies
None
Usage
from pathlib import Path
from provide_dir import provide_dir
needed_path = Path("/path/to/directory/with/subdirectories")
try:
was_created = provide_path(needed_path)
if was_created:
print(f"{needed_path} was successfully created")
else:
print(f"{needed_path} already exists")
except FileExistsError:
print(f"Cannot create {needed_path} because it already exists as a file")
Installation
Pip
pip install provide_dir
Developer's Installation
You can clone the repository and install it with pip install -e /path/to/local/repository
.
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
provide_dir-0.0.3.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for provide_dir-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c008d99e8704ec1d04bd108919389e1fd72cefb16abf57d21eea3fa9add48b4 |
|
MD5 | 7ed4390268821b082b098e0cc4909e2d |
|
BLAKE2b-256 | bd1e1bc0ad4f20a01b2829ca4f2f07a6d74467e36e52ce5d6b498d95c46b40bc |