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.2.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for provide_dir-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a13cfeaf6b794be5fda839ca60048b28578f5004eadb6ebd52471f2e70610065 |
|
MD5 | d64b5048ccedef3e00d95aa928d5139b |
|
BLAKE2b-256 | d622fc715ebea180553b2b612e9db8daae1a96cd288ff7122fbe55ad320a3c11 |