path_ module¶
Utilities for working with paths.
check_mkdir function¶
Check whether the path to a directory exists and create if it doesn't.
For defaults, see mkdir in path.
dir_exists function¶
Check whether a directory exists.
dir_size function¶
Get size of a directory.
dir_tree function¶
dir_tree(
dir_path,
level=-1,
limit_to_directories=False,
length_limit=1000,
sort=True,
space=' ',
branch='│ ',
tee='├── ',
last='└── '
)
Given a directory Path object print a visual tree structure.
Inspired by this answer: https://stackoverflow.com/a/59109706
file_exists function¶
Check whether a file exists.
file_size function¶
Get size of a file.
list_any_files function¶
List files and directories matching a path.
If the directory path is not provided, the current working directory is used.
list_dirs function¶
List directories matching a path using list_any_files().
list_files function¶
List files matching a path using list_any_files().
make_dir function¶
Make an empty directory.
make_file function¶
Make an empty file.
print_dir_tree function¶
Generate a directory tree with tree and print it out.
remove_dir function¶
Remove (delete) a directory.
remove_file function¶
Remove (delete) a file.