NicePath Documentation

NicePath is an advanced OOP wrapper around pathlib with smart search, logging and safety systems.

Path Types

Absolute Path

NicePath("C:/Projects/file.txt")

Relative Path

NicePath("data/file.txt")

Caller Relative Path

NicePath("data/file.txt" , base_dir = __file__)

NicePath resolves relative paths based on the caller file location, not the execution directory.

File Operations

Write

NicePath("a.txt").write("Hello")

Read

NicePath("a.txt").read()

Append

NicePath("a.txt").append("More")

Move

NicePath("a.txt").move_to("b.txt")

Copy

NicePath("a.txt").copy_to("backup/a.txt")

Tree

NicePath("project").tree(
    recursive=True,
    ignore_hidden=True,
    ignore_venv=True
)

Generates a graphical folder tree.

logAll

root = NicePath("project")
log = NicePath("log.txt")

root.logAll(
    file_output=log,
    search_suffix=".py",
    ignore_venv=True
)

Safety System

If safety limit is reached: • Process stops safely • Warning is logged • No crash occurs